refactoring: remove duplicate code.

Signed-off-by: Kim Kulling <kim.kulling@googlemail.com>