refine editor code