Refactor part of rolling back multithreading.