refactoring and change map format