move the map reduce functions into libmapreduce.c