Adding Exception handling