Updated manageInventory function