Add unit tests and docblocks.