diff --git a/src/@dates/max.m b/src/@dates/max.m
index fef48fed0786d410d3f8506e819b1c1f7fda97ee..837071acbc530dab80d76db2b32fef0e52da0ab2 100644
--- a/src/@dates/max.m
+++ b/src/@dates/max.m
@@ -1,17 +1,21 @@
-function C = max(varargin)
+function q = max(varargin)  % --*-- Unitary tests --*--
     
 % Overloads the max function for dates objects.
-    
-% Copyright (C) 2013 Dynare Team
 %
-% This file is part of Dynare.
+% INPUTS 
+% - varargin [dates]
+%
+% OUTPUTS 
+% - q [dates]
+
+% Copyright (C) 2013-2014 Dynare Team
 %
-% Dynare is free software: you can redistribute it and/or modify
+% This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
 % the Free Software Foundation, either version 3 of the License, or
 % (at your option) any later version.
 %
-% Dynare is distributed in the hope that it will be useful,
+% Dynare dates submodule is distributed in the hope that it will be useful,
 % but WITHOUT ANY WARRANTY; without even the implied warranty of
 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 % GNU General Public License for more details.
@@ -19,22 +23,19 @@ function C = max(varargin)
 % You should have received a copy of the GNU General Public License
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
+if ~all(cellfun(@isdates,varargin))
+    error('dates:max:ArgCheck','All input arguments must be dates objects.')
+end
+
 switch nargin
   case 1
-    switch length(varargin{1})
-      case 0
-        C= dates();
-      case 1
-        C = varargin{1};
-      otherwise
-        tmp = sortrows(varargin{1}.time);
-        C = dates();
-        C.freq = varargin{1}.freq;
-        C.ndat = 1;
-        C.time = tmp(varargin{1}.ndat,:);
-    end
+    sorted_time_member = sortrows(varargin{1}.time);
+    q = dates();
+    q.freq = varargin{1}.freq;
+    q.ndat = 1;
+    q.time = sorted_time_member(varargin{1}.ndat,:);
   otherwise
-    C = max(horzcat(varargin{:}));
+    q = max(horzcat(varargin{:}));
 end
 
 %@test:1
@@ -49,8 +50,8 @@ end
 %$ i3 = (m3==d5);
 %$
 %$ % Check the results.
-%$ t(1) = dassert(i2,1);
-%$ t(2) = dassert(i3,1);
+%$ t(1) = dassert(i2,true);
+%$ t(2) = dassert(i3,true);
 %$ T = all(t);
 %@eof:1
 
@@ -61,7 +62,7 @@ end
 %$ i = (m==dates('1951Q3'));
 %$
 %$ % Check the results.
-%$ t(1) = dassert(i,1);
+%$ t(1) = dassert(i,true);
 %$ T = all(t);
 %@eof:2
 
@@ -71,7 +72,7 @@ end
 %$ i = (m==dates('1951Q3'));
 %$
 %$ % Check the results.
-%$ t(1) = dassert(i,1);
+%$ t(1) = dassert(i,true);
 %$ T = all(t);
 %@eof:3
 
@@ -81,6 +82,6 @@ end
 %$ i = (m==dates('1951Q3'));
 %$
 %$ % Check the results.
-%$ t(1) = dassert(i,1);
+%$ t(1) = dassert(i,true);
 %$ T = all(t);
 %@eof:4
\ No newline at end of file