Avoid unnecessary code duplication

Signed-off-by: Stefan Marr <git@stefan-marr.de>