Fixed concurrency, and streamlined code slightly.