Add @throws documentation for cases where it was missing.

Also make a few small changes to function documentation.