Massive Refactoring to make PMD happy