simplified getIndex function ... what was I thinking