Cleaned up the functions in controller, modified views.