(WIP) Immutable headnodes

This is probably worth looking at now; there's still some work to do, but it's roughly the shape I'm shooting for.