Lots of Sonar violation fixes.