refactors map into view