Fixed a bunch of sonar violations