Refactoring of user.rb