Tiny improvements, still needing the real algorithm for rebuilding.