Complete rewrite / cleanup of the node side