todo, modify remove_node and finish remove_useless_nodes