Refactoring and cleanup of map view code.