Fixing a bunch of Sonar violations