Draft for map and reduce functionality