Made modifications to .reduce & .map