refactored code from view to controller