Implemented flushing as a temporary hack.