refactor sales_engine.rb