revised indices code and other functions -KL