improve concurrency code