Adding Exception handling.