Introduced serialize / deserialize into the new rebuild; fixed some serialize bugs. Needs testing on multi-level trees.