refactoring 'map'