should improve performance a bit
some findbugs and pmd fixes