Update documentation and exception handling, and fix minor bugs