refactor inventory method