Small refactors to reduce the amount of duplicated code, and to avoid too many...

Small refactors to reduce the amount of duplicated code, and to avoid too many method parameters. All these are 'code smells' found by SonarQube.
1 job for reduce-duplicated-code in 11 minutes and 14 seconds (queued for 11 minutes and 43 seconds)
Status Job ID Name Coverage
  Test
passed #12308
build

00:11:14