refactoring and map wrapper implementation