added comments to explain the clear calls