restructured tok8x.c for greater sanity