Refactoring and clean up

Improves our PMD and FindBugs scores