Finished implementation of NMH traversal and rebuild code.

Added minor other improvements.