started refactoring new map code