Fixed up this. Store the material so you don't have to get it multiple times.
Also use StringUtils.containsIgnoreCase() instead of String.contains()