remove parens
use list rather than concatenated disjunction
add mode lookup
factor mode lookups back together
move fn out of way