Factor out subselect from add_nodes_list
Factor out subselect from add_ways_list