Added task completion logic