refactor code @ add_data.rb