Inventory refactoring (not tested)