another attempt at getting a stock, this time cleaner code