Added second type param to Idx and idxGen fn.