cleanup MapReduce code