modified the controller.cpp