adding purchase functionality