Representing a task using a class instead of a pair