Added exception processing