Made pipes code more simpler using InventoryUtil.