Added some exception handling
Added Exception Handling