rewritten the buy/sell