Update deletion

This closes ticket #39 and fixes a few ridiculous bugs.