refactor addmap