Refactored the injection mechanism out of the Task class