added documentation for exception handling