Add codes for stock in functions