refactoring identity.rb