Documented all exceptions and did some general cleanups