refactored inventory lookup