refactored data.rb