Moving task completion logic into model.