commenting and refactoring the Task class