Implemented Exception Handling