Slight changes to try-catch logic