Refactored code to implement TaskModel struct.