Replace genIdx

New generator replacing the genIdx.  This is still not as fast as we could do it, but it's probably not worth spending any more time on it...