re-working threading model to allow for synchronous flushing