GetIndex1D and some cleanups.