improved purchase functionality, kinda works now