Add 'const' where appropriate to index handling functions