task service refactoring