Refactor sales logic