Added use of try/catch blocks.