Cleaned up try, except, finally statements