Sonar: Reduce cyclomatic complexity