Refactoring node.py