Updated clearTask() Method