rewrite node.erl from scratch