cleaned up the code in controller and user.rb