Cleanup and add update tests.

This cleans up a number of lines of code. Randomly scattered.

Adds testUpdateWithNilDocument.

Adds testUpdateDelete, but this is entirely commented out at the moment
because the test does not pass.