Apply recommendations from Sonar.