Finished implementing the controller