got buy function to work!!!!