Better exception logging and docstrings

Tested manually