Refactoring code into a nodemanager structure.