removed multiplied code for exception handling