Continue refactoring sell function