code for harvesting