Add try-catch blocks