Remove duplicate code

code-deduplication: abrummet