Rewritten to be truly asyc.