Updated code to remove the finally clause.