cleaned up controller code
cleaned controller code 2