Implemented summing in map function