made some changes to controller