refactoring around the locations controller