cleanup and document and improve tests for new mapreduce code