Fixed various sonar issues.