More resize code, at the moment the isHeadKvs function requires a bit of nut knacking.