Added Exception handling