LOOP
FOR i IN 1..array_upper(relation.members, 1) BY 2 LOOP
IF relation.members[i+1] in ('', 'main_stream') AND substring(relation.members[i],1,1) = 'w' THEN
LOOP
FOR i IN 1..array_upper(relation.members, 1) BY 2 LOOP
IF relation.members[i+1] in ('', 'main_stream') AND substring(relation.members[i],1,1) = 'w' THEN