move concurrency stuff to top for readability