Moves logic out of user.rb