Moved starting code of the async writer from the main module.