Ported voxlap5.c up to line 3691