ext: removed code duplication