added top_node variable