Editted completeTask and searchTask for logic