SONAR fix: reorganise code to match code conventions.