code to transform pairs of flags added