porting editor code