refactor maps controller