Incorporated Ryan's suggested changes and added a couple tests for various archive and delete situations.