continuing work porting code from Ilwis3