Cleaned code.
Removed the interrupt that caused the flushing thread to terminate
prematurely.