Refactor task spec.