Cleaned up some code in the controllers