add buy function