Refactoring TaskExecutor.