Added search and replace in SetFlag