JDK1.6 compatibility, some sonar recommendations fixed