Rewrite of classes and fixes for PMD