Some refactor on map API