implement inventory function