rewrite Node as class