reworked find_node logic