Added exception handling in driver program.