cosmetics: removed code duplication