refactored inventory controller for simplicity