Added an outer try-catch for any exceptions that might arise