Concurrency improvements

Cherry-picking some useful and non-world-shattering stuff from #12.