Move getIdx to common trait