now the inventory function works