Essays on the environmental effects of agricultural production