improve concurrency and add comments