refactor sonar