(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.
No, line 186 is fine. It's the ('%d' % nic) on line 188 it that's going to bomb out with a type error.