Adds docstrings.

Squashed commit of the following:

commit 253f201eaed3e2b4963d4f5eb40107a25c487172
Author: Christopher Foo <chris.foo@gmail.com>
Date:   Tue Nov 19 22:49:34 2013 +0800

    Fixes docstring directives.

commit 9cb3aed02daade7fcf8ba77c971baf95f8ec112b
Author: Christopher Foo <chris.foo@gmail.com>
Date:   Tue Nov 19 22:34:34 2013 +0800

    Adds docstrings.