finish porting textproc