reorganized code to decouple from UI editors