Moved delete cidfile logic