Add infrastructure for primitive indexes
FIX Potential Bug in index order