removed unused variable
catch exception by reference
catch exceptions by reference