refactor the node and edge