Complete newLocation function in controller.