Add documentation to the functions.

Some parameter types have been left blank as there is no indication from the
code on the type of parameter used.
Change tabs to spaces throughout the file