Cleaned up the controller