lots of cleanup and refactoring of the node maps code