added toggle for flush on or off