Adding map reduce functions