Minor reorganization.
Mostly reorganization.
Rewrote part of the node task function.