Amend index and indexBy functions
Amend typo