Clean up code in node manager.