added flag stuff