Fixed code with suggestions from Sonar code analysis