refactor code to create map and chat views