Refactoring task class