Modified and cleaned the Controller.