Refactoring controllers and creating karma tests for location