map reduce prototype (not working)