Complete a task function