heap_index: overhaul deep index stuff to use a sane implementation.