Solving sonar warnings