Cleaned up some code.  Added a new test for document delivery via email attachment.