finish porting from rtf