Add Document.Id and code clean up

Add the Document.Id that stores the result of the document being posted.
Also, clean up some function names and add copyright headers.
Add hack of command-line parsing to test plus copyright headers.