Fixed problems found by package check

Updated the documentation of most functions (some still need
improving), fixed the warnings given by the package check, and updated
the examples.