adding tests for MapAggregate
adding the extra tests
refactoring some methods