the buy/sell logic is getting really messy