concurrency refactoring