Added each, map and refactored