(#1012) - move map reduce out