Added getIndex(), with tests.