refactor Node/Tree classes