beginning of map refactor