moved from view to controller