added purchase functionality