Chainheaders update

Move from many variables to arrays. This will minimize read/write
operations and should be cheaper.
It's also easier to understand this way, IMO.

Searching the chain is also inefficient. All that is needed is to make
sure c.m[parent] exists and c.m[me] does not.
Remove some crap from chainheaders