Added exception handling by code