working on buy functionality