diff --git a/preprocessor b/preprocessor
index fac9e4436c1c1f7d97e03d5fee77f7fb45dff54a..9e454debb5eb7cbabcf29e844e16f2463d8d7eb6 160000
--- a/preprocessor
+++ b/preprocessor
@@ -1 +1 @@
-Subproject commit fac9e4436c1c1f7d97e03d5fee77f7fb45dff54a
+Subproject commit 9e454debb5eb7cbabcf29e844e16f2463d8d7eb6
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1b6fef0141a829bbca544e23b2c6bae58ef66d22..5b4698caa89795ab707ad95928dfa34d296b9ec9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -173,12 +173,14 @@ MODFILES = \
 	dsge-var/simul_hybrid.mod \
 	dsge-var/dsgevar_forward_calibrated_lambda.mod \
 	dsge-var/dsgevar_forward_estimated_lambda.mod \
-	external_function/first_and_2nd_deriv_fcns_provided.mod \
-	external_function/first_and_2nd_deriv_fcns_provided_dll.mod \
-	external_function/first_deriv_fcn_provided.mod \
-	external_function/first_deriv_fcn_provided_dll.mod \
-	external_function/no_deriv_fcns_provided.mod \
-	external_function/no_deriv_fcns_provided_dll.mod \
+	external_function/first_deriv_given.mod \
+	external_function/first_deriv_given_dll.mod \
+	external_function/first_and_2nd_deriv_given.mod \
+	external_function/first_and_2nd_deriv_given_namespace.mod \
+	external_function/first_and_2nd_deriv_given_dll.mod \
+	external_function/first_and_2nd_deriv_given_dll_namespace.mod \
+	external_function/no_deriv_given.mod \
+	external_function/no_deriv_given_dll.mod \
 	seeds.mod \
 	identification/kim/kim2.mod \
 	identification/as2007/as2007.mod \
diff --git a/tests/external_function/+matlab/+namespace/extFunNoDerivsNamespace.m b/tests/external_function/+matlab/+namespace/extFunNoDerivsNamespace.m
new file mode 100644
index 0000000000000000000000000000000000000000..a05eb9861b229649701314eb29475a8edbfa5923
--- /dev/null
+++ b/tests/external_function/+matlab/+namespace/extFunNoDerivsNamespace.m
@@ -0,0 +1,3 @@
+function y=extFunNoDerivsNamespace(a,b)
+y=a*(b^2);
+end
\ No newline at end of file
diff --git a/tests/external_function/+matlab/+namespace/extFunWithFirstAndSecondDerivsNamespace.m b/tests/external_function/+matlab/+namespace/extFunWithFirstAndSecondDerivsNamespace.m
new file mode 100644
index 0000000000000000000000000000000000000000..25d4a80f7dedf98785c1f81f6b24eecfee8f97c4
--- /dev/null
+++ b/tests/external_function/+matlab/+namespace/extFunWithFirstAndSecondDerivsNamespace.m
@@ -0,0 +1,9 @@
+function [y df d2f]=extFunWithFirstAndSecondDerivsNamespace(a,b)
+y=a*(b^2);
+
+da=b^2;
+db=2*a*b;
+df=[da db];
+
+d2f=[0 2*b; 2*b 2*a];
+end
\ No newline at end of file
diff --git a/tests/external_function/first_and_2nd_deriv_fcns_provided.mod b/tests/external_function/first_and_2nd_deriv_given.mod
similarity index 100%
rename from tests/external_function/first_and_2nd_deriv_fcns_provided.mod
rename to tests/external_function/first_and_2nd_deriv_given.mod
diff --git a/tests/external_function/first_and_2nd_deriv_fcns_provided_dll.mod b/tests/external_function/first_and_2nd_deriv_given_dll.mod
similarity index 100%
rename from tests/external_function/first_and_2nd_deriv_fcns_provided_dll.mod
rename to tests/external_function/first_and_2nd_deriv_given_dll.mod
diff --git a/tests/external_function/first_and_2nd_deriv_given_dll_namespace.mod b/tests/external_function/first_and_2nd_deriv_given_dll_namespace.mod
new file mode 100644
index 0000000000000000000000000000000000000000..a868c4193a5f480db2afadfbae3f50a690fd4754
--- /dev/null
+++ b/tests/external_function/first_and_2nd_deriv_given_dll_namespace.mod
@@ -0,0 +1,48 @@
+// Example 1 from Collard's guide to Dynare
+var y, c, k, a, h, b;
+varexo e, u;
+
+parameters beta, rho, alpha, delta, theta, psi, tau;
+
+alpha = 0.36;
+rho   = 0.95;
+tau   = 0.025;
+beta  = 0.99;
+delta = 0.025;
+psi   = 0;
+theta = 2.95;
+
+phi   = 0.1;
+
+addpath(pwd)
+
+external_function(nargs=2, name=matlab.namespace.extFunWithFirstAndSecondDerivsNamespace, first_deriv_provided, second_deriv_provided);
+
+model(use_dll);
+c*theta*h^(1+psi)=(1-alpha)*y;
+k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1)))
+    *(exp(b(+1))*alpha*y(+1)+(1-delta)*k));
+y = exp(a)*(k(-1)^alpha)*(h^(1-alpha));
+k = exp(b)*(y-c)+matlab.namespace.extFunWithFirstAndSecondDerivsNamespace((1-delta),k(-1));
+a = rho*a(-1)+tau*b(-1) + e;
+b = tau*a(-1)+rho*b(-1) + u;
+end;
+
+initval;
+y = 1.08068253095672;
+c = 0.80359242014163;
+h = 0.29175631001732;
+k = 11.08360443260358;
+a = 0;
+b = 0;
+e = 0;
+u = 0;
+end;
+
+shocks;
+var e; stderr 0.009;
+var u; stderr 0.009;
+var e, u = phi*0.009*0.009;
+end;
+
+stoch_simul;
diff --git a/tests/external_function/first_and_2nd_deriv_given_namespace.mod b/tests/external_function/first_and_2nd_deriv_given_namespace.mod
new file mode 100644
index 0000000000000000000000000000000000000000..1cefa83999d6acae33564391e0314b28b7a6372e
--- /dev/null
+++ b/tests/external_function/first_and_2nd_deriv_given_namespace.mod
@@ -0,0 +1,48 @@
+// Example 1 from Collard's guide to Dynare
+var y, c, k, a, h, b;
+varexo e, u;
+
+parameters beta, rho, alpha, delta, theta, psi, tau;
+
+alpha = 0.36;
+rho   = 0.95;
+tau   = 0.025;
+beta  = 0.99;
+delta = 0.025;
+psi   = 0;
+theta = 2.95;
+
+phi   = 0.1;
+
+addpath(pwd)
+
+external_function(nargs=2, name=matlab.namespace.extFunWithFirstAndSecondDerivsNamespace, first_deriv_provided, second_deriv_provided);
+
+model;
+c*theta*h^(1+psi)=(1-alpha)*y;
+k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1)))
+    *(exp(b(+1))*alpha*y(+1)+(1-delta)*k));
+y = exp(a)*(k(-1)^alpha)*(h^(1-alpha));
+k = exp(b)*(y-c)+matlab.namespace.extFunWithFirstAndSecondDerivsNamespace((1-delta),k(-1));
+a = rho*a(-1)+tau*b(-1) + e;
+b = tau*a(-1)+rho*b(-1) + u;
+end;
+
+initval;
+y = 1.08068253095672;
+c = 0.80359242014163;
+h = 0.29175631001732;
+k = 11.08360443260358;
+a = 0;
+b = 0;
+e = 0;
+u = 0;
+end;
+
+shocks;
+var e; stderr 0.009;
+var u; stderr 0.009;
+var e, u = phi*0.009*0.009;
+end;
+
+stoch_simul;
diff --git a/tests/external_function/first_deriv_fcn_provided.mod b/tests/external_function/first_deriv_given.mod
similarity index 100%
rename from tests/external_function/first_deriv_fcn_provided.mod
rename to tests/external_function/first_deriv_given.mod
diff --git a/tests/external_function/first_deriv_fcn_provided_dll.mod b/tests/external_function/first_deriv_given_dll.mod
similarity index 100%
rename from tests/external_function/first_deriv_fcn_provided_dll.mod
rename to tests/external_function/first_deriv_given_dll.mod
diff --git a/tests/external_function/no_deriv_fcns_provided.mod b/tests/external_function/no_deriv_given.mod
similarity index 100%
rename from tests/external_function/no_deriv_fcns_provided.mod
rename to tests/external_function/no_deriv_given.mod
diff --git a/tests/external_function/no_deriv_fcns_provided_dll.mod b/tests/external_function/no_deriv_given_dll.mod
similarity index 100%
rename from tests/external_function/no_deriv_fcns_provided_dll.mod
rename to tests/external_function/no_deriv_given_dll.mod