Replacing getIndex