Exception handling implemented