task generation refactoring