implement flushing