refactored some functionality away from main controller.