Add unit tests for module loading.

Also add docstrings to new functions.