put logic in controller
moved logic to model