more refactoring in user.rb