Implemented auto-flushing