Resolve Sonar issues and warnings