using a flags variable