Add toString method for Index class
Improve error messages