Added some checks to prevent accidental deletion