Refactored the code, added comments, and move the delete to a file.
Refactored the code, added comments, and move the delete to a file.