Added additional exception handling