refactoring to make executor testable ;)
more refactoring and add a test for long-running task execution