Added a new message class to deal with success/error messages. Cleaned up the contorller code