modify code to buy logic