use async io (works but needs tidying) (#20)