inventory refactoring