Add PMD and fix issues.
Checkstyle rule tweaks and code fixes
Fixes broken test