#506 A few changes to indexing logic.