abstracted a lot of the flag module