map directive refactoring