More work on index functions.

In particular, an unsafe interface!