Use a proper datatype, rather than pairs, for flags