Fixed a number of PMD warnings