removed code duplication in editor