diff -r e429ddca0d51 libinterp/corefcn/__dsearchn__.cc
--- a/libinterp/corefcn/__dsearchn__.cc	Fri Dec 11 11:40:31 2015 -0500
+++ b/libinterp/corefcn/__dsearchn__.cc	Sat Dec 12 19:32:51 2015 +0100
@@ -95,8 +95,7 @@
           pxi += n;
         }
 
-      retval(1) = dist;
-      retval(0) = idx;
+      retval = ovl (idx, dist);
     }
 
   return retval;
diff -r e429ddca0d51 libinterp/corefcn/balance.cc
--- a/libinterp/corefcn/balance.cc	Fri Dec 11 11:40:31 2015 -0500
+++ b/libinterp/corefcn/balance.cc	Sat Dec 12 19:32:51 2015 +0100
@@ -158,17 +158,17 @@
               FloatComplexAEPBALANCE result (fcaa, noperm, noscal);
 
               if (nargout == 0 || nargout == 1)
-                retval(0) = result.balanced_matrix ();
+                retval = ovl (result.balanced_matrix ());
               else if (nargout == 2)
                 {
-                  retval(1) = result.balanced_matrix ();
-                  retval(0) = result.balancing_matrix ();
+                  retval = ovl (result.balancing_matrix (),
+                                result.balanced_matrix ());
                 }
               else
                 {
-                  retval(2) = result.balanced_matrix ();
-                  retval(1) = result.permuting_vector ();
-                  retval(0) = result.scaling_vector ();
+                  retval = ovl (result.scaling_vector (),
+                                result.permuting_vector (),
+                                result.balanced_matrix ());
                 }
 
             }
@@ -177,17 +177,17 @@
               FloatAEPBALANCE result (faa, noperm, noscal);
 
               if (nargout == 0 || nargout == 1)
-                retval(0) = result.balanced_matrix ();
+                retval = ovl (result.balanced_matrix ());
               else if (nargout == 2)
                 {
-                  retval(1) = result.balanced_matrix ();
-                  retval(0) = result.balancing_matrix ();
+                  retval = ovl (result.balancing_matrix (),
+                                result.balanced_matrix ());
                 }
               else
                 {
-                  retval(2) = result.balanced_matrix ();
-                  retval(1) = result.permuting_vector ();
-                  retval(0) = result.scaling_vector ();
+                  retval = ovl (result.scaling_vector (),
+                                result.permuting_vector (),
+                                result.balanced_matrix ());
                 }
             }
         }
@@ -198,17 +198,17 @@
               ComplexAEPBALANCE result (caa, noperm, noscal);
 
               if (nargout == 0 || nargout == 1)
-                retval(0) = result.balanced_matrix ();
+                retval = ovl (result.balanced_matrix ());
               else if (nargout == 2)
                 {
-                  retval(1) = result.balanced_matrix ();
-                  retval(0) = result.balancing_matrix ();
+                  retval = ovl (result.balancing_matrix (),
+                                result.balanced_matrix ());
                 }
               else
                 {
-                  retval(2) = result.balanced_matrix ();
-                  retval(1) = result.permuting_vector ();
-                  retval(0) = result.scaling_vector ();
+                  retval = ovl (result.scaling_vector (),
+                                result.permuting_vector (),
+                                result.balanced_matrix ());
                 }
             }
           else
@@ -216,17 +216,17 @@
               AEPBALANCE result (aa, noperm, noscal);
 
               if (nargout == 0 || nargout == 1)
-                retval(0) = result.balanced_matrix ();
+                retval = ovl (result.balanced_matrix ());
               else if (nargout == 2)
                 {
-                  retval(1) = result.balanced_matrix ();
-                  retval(0) = result.balancing_matrix ();
+                  retval = ovl (result.balancing_matrix (),
+                                result.balanced_matrix ());
                 }
               else
                 {
-                  retval(2) = result.balanced_matrix ();
-                  retval(1) = result.permuting_vector ();
-                  retval(0) = result.scaling_vector ();
+                  retval = ovl (result.scaling_vector (),
+                                result.permuting_vector (),
+                                result.balanced_matrix ());
                 }
             }
         }
@@ -282,15 +282,15 @@
                   retval(3) = result.balanced_matrix2 ();
                   // fall through
                 case 3:
-                  retval(2) = result.balanced_matrix ();
-                  retval(1) = result.balancing_matrix2 ();
-                  retval(0) = result.balancing_matrix ();
+                  retval = ovl (result.balancing_matrix (),
+                                result.balancing_matrix2 (),
+                                result.balanced_matrix ());
                   break;
                 case 2:
                   retval(1) = result.balancing_matrix2 ();
                   // fall through
                 case 1:
-                  retval(0) = result.balancing_matrix ();
+                  retval = ovl (result.balancing_matrix ());
                   break;
                 default:
                   error ("balance: invalid number of output arguments");
@@ -307,15 +307,15 @@
                   retval(3) = result.balanced_matrix2 ();
                   // fall through
                 case 3:
-                  retval(2) = result.balanced_matrix ();
-                  retval(1) = result.balancing_matrix2 ();
-                  retval(0) = result.balancing_matrix ();
+                  retval = ovl (result.balancing_matrix (),
+                                result.balancing_matrix2 (),
+                                result.balanced_matrix ());
                   break;
                 case 2:
                   retval(1) = result.balancing_matrix2 ();
                   // fall through
                 case 1:
-                  retval(0) = result.balancing_matrix ();
+                  retval = ovl (result.balancing_matrix ());
                   break;
                 default:
                   error ("balance: invalid number of output arguments");
@@ -335,15 +335,15 @@
                   retval(3) = result.balanced_matrix2 ();
                   // fall through
                 case 3:
-                  retval(2) = result.balanced_matrix ();
-                  retval(1) = result.balancing_matrix2 ();
-                  retval(0) = result.balancing_matrix ();
+                  retval = ovl (result.balancing_matrix (),
+                                result.balancing_matrix2 (),
+                                result.balanced_matrix ());
                   break;
                 case 2:
                   retval(1) = result.balancing_matrix2 ();
                   // fall through
                 case 1:
-                  retval(0) = result.balancing_matrix ();
+                  retval = ovl (result.balancing_matrix ());
                   break;
                 default:
                   error ("balance: invalid number of output arguments");
@@ -360,15 +360,15 @@
                   retval(3) = result.balanced_matrix2 ();
                   // fall through
                 case 3:
-                  retval(2) = result.balanced_matrix ();
-                  retval(1) = result.balancing_matrix2 ();
-                  retval(0) = result.balancing_matrix ();
+                  retval = ovl (result.balancing_matrix (),
+                                result.balancing_matrix2 (),
+                                result.balanced_matrix ());
                   break;
                 case 2:
                   retval(1) = result.balancing_matrix2 ();
                   // fall through
                 case 1:
-                  retval(0) = result.balancing_matrix ();
+                  retval = ovl (result.balancing_matrix ());
                   break;
                 default:
                   error ("balance: invalid number of output arguments");
diff -r e429ddca0d51 libinterp/corefcn/eig.cc
--- a/libinterp/corefcn/eig.cc	Fri Dec 11 11:40:31 2015 -0500
+++ b/libinterp/corefcn/eig.cc	Sat Dec 12 19:32:51 2015 +0100
@@ -153,7 +153,7 @@
 
       if (nargout == 0 || nargout == 1)
         {
-          retval(0) = result.eigenvalues ();
+          retval = ovl (result.eigenvalues ());
         }
       else
         {
@@ -161,8 +161,7 @@
 
           FloatComplexDiagMatrix d (result.eigenvalues ());
 
-          retval(1) = d;
-          retval(0) = result.eigenvectors ();
+          retval = ovl (result.eigenvectors (), d);
         }
     }
   else
@@ -204,7 +203,7 @@
 
       if (nargout == 0 || nargout == 1)
         {
-          retval(0) = result.eigenvalues ();
+          retval = ovl (result.eigenvalues ());
         }
       else
         {
@@ -212,8 +211,7 @@
 
           ComplexDiagMatrix d (result.eigenvalues ());
 
-          retval(1) = d;
-          retval(0) = result.eigenvectors ();
+          retval = ovl (result.eigenvectors (), d);
         }
     }
 
diff -r e429ddca0d51 libinterp/corefcn/getgrent.cc
--- a/libinterp/corefcn/getgrent.cc	Fri Dec 11 11:40:31 2015 -0500
+++ b/libinterp/corefcn/getgrent.cc	Sat Dec 12 19:32:51 2015 +0100
@@ -54,10 +54,10 @@
       m.assign ("gid", static_cast<double> (gr.gid ()));
       m.assign ("mem", octave_value (gr.mem ()));
 
-      retval = m;
+      retval = ovl (m);
     }
   else
-    retval = 0;
+    retval = ovl (0);
 
   return retval;
 }
@@ -81,8 +81,7 @@
   // octave_group::getgrent may set msg.
   octave_value val = mk_gr_map (octave_group::getgrent (msg));
 
-  retval(1) = msg;
-  retval(0) = val;
+  retval = ovl (val, msg);
 
   return retval;
 }
@@ -113,8 +112,7 @@
       // octave_group::getgrgid may set msg.
       octave_value val = mk_gr_map (octave_group::getgrgid (gid, msg));
 
-      retval(1) = msg;
-      retval(0) = val;
+      retval = ovl (val, msg);
     }
 
   else
@@ -145,8 +143,7 @@
   // octave_group::getgrnam may set msg.
   octave_value val = mk_gr_map (octave_group::getgrnam (s.c_str (), msg));
 
-  retval(1) = msg;
-  retval(0) = val;
+  retval = ovl (val, msg);
 
   return retval;
 }
@@ -168,8 +165,7 @@
   // octave_group::setgrent may set msg.
   int status = octave_group::setgrent (msg);
 
-  retval(1) = msg;
-  retval(0) = static_cast<double> (status);
+  retval = ovl (static_cast<double> (status), msg);
 
   return retval;
 }
@@ -191,8 +187,7 @@
   // octave_group::endgrent may set msg.
   int status = octave_group::endgrent (msg);
 
-  retval(1) = msg;
-  retval(0) = static_cast<double> (status);
+  retval = ovl (static_cast<double> (status), msg);
 
   return retval;
 }
diff -r e429ddca0d51 libinterp/corefcn/getpwent.cc
--- a/libinterp/corefcn/getpwent.cc	Fri Dec 11 11:40:31 2015 -0500
+++ b/libinterp/corefcn/getpwent.cc	Sat Dec 12 19:32:51 2015 +0100
@@ -57,10 +57,10 @@
       m.assign ("dir", pw.dir ());
       m.assign ("shell", pw.shell ());
 
-      retval = m;
+      retval = ovl (m);
     }
   else
-    retval = 0;
+    retval = ovl (0);
 
   return retval;
 }
@@ -85,8 +85,7 @@
   // octave_passwd::getpwent may set msg.
   octave_value val = mk_pw_map (octave_passwd::getpwent (msg));
 
-  retval(1) = msg;
-  retval(0) = val;
+  retval = ovl (val, msg);
 
   return retval;
 }
@@ -117,8 +116,7 @@
       // octave_passwd::getpwuid may set msg.
       octave_value val = mk_pw_map (octave_passwd::getpwuid (uid, msg));
 
-      retval(1) = msg;
-      retval(0) = val;
+      retval = ovl (val, msg);
     }
   else
     error ("getpwuid: UID must be an integer");
@@ -148,8 +146,7 @@
   // octave_passwd::getpwnam may set msg.
   octave_value val = mk_pw_map (octave_passwd::getpwnam (s, msg));
 
-  retval(1) = msg;
-  retval(0) = val;
+  retval = ovl (val, msg);
 
   return retval;
 }
@@ -171,8 +168,7 @@
   // octave_passwd::setpwent may set msg.
   int status = octave_passwd::setpwent (msg);
 
-  retval(1) = msg;
-  retval(0) = static_cast<double> (status);
+  retval = ovl (static_cast<double> (status), msg);
 
   return retval;
 }
@@ -194,8 +190,7 @@
   // octave_passwd::endpwent may set msg.
   int status = octave_passwd::endpwent (msg);
 
-  retval(1) = msg;
-  retval(0) = static_cast<double> (status);
+  retval = ovl (static_cast<double> (status), msg);
 
   return retval;
 }
diff -r e429ddca0d51 libinterp/corefcn/givens.cc
--- a/libinterp/corefcn/givens.cc	Fri Dec 11 11:40:31 2015 -0500
+++ b/libinterp/corefcn/givens.cc	Sat Dec 12 19:32:51 2015 +0100
@@ -92,12 +92,11 @@
             {
             case 0:
             case 1:
-              retval(0) = result;
+              retval = ovl (result);
               break;
 
             case 2:
-              retval(1) = result (0, 1);
-              retval(0) = result (0, 0);
+              retval = ovl (result(0, 0), result(0, 1));
               break;
             }
         }
@@ -112,12 +111,11 @@
             {
             case 0:
             case 1:
-              retval(0) = result;
+              retval = ovl (result);
               break;
 
             case 2:
-              retval(1) = result (0, 1);
-              retval(0) = result (0, 0);
+              retval = ovl (result(0, 0), result(0, 1));
               break;
             }
         }
@@ -135,12 +133,11 @@
             {
             case 0:
             case 1:
-              retval(0) = result;
+              retval = ovl (result);
               break;
 
             case 2:
-              retval(1) = result (0, 1);
-              retval(0) = result (0, 0);
+              retval = ovl (result(0, 0), result(0, 1));
               break;
             }
         }
@@ -155,12 +152,11 @@
             {
             case 0:
             case 1:
-              retval(0) = result;
+              retval = ovl (result);
               break;
 
             case 2:
-              retval(1) = result (0, 1);
-              retval(0) = result (0, 0);
+              retval = ovl (result(0, 0), result(0, 1));
               break;
             }
         }
diff -r e429ddca0d51 libinterp/corefcn/quad.cc
--- a/libinterp/corefcn/quad.cc	Fri Dec 11 11:40:31 2015 -0500
+++ b/libinterp/corefcn/quad.cc	Sat Dec 12 19:32:51 2015 +0100
@@ -306,10 +306,7 @@
           break;
         }
 
-      retval(3) = abserr;
-      retval(2) = nfun;
-      retval(1) = ier;
-      retval(0) = val;
+      retval = ovl (val, ier, nfun, abserr);
 
     }
   else
@@ -401,10 +398,7 @@
           break;
         }
 
-      retval(3) = abserr;
-      retval(2) = nfun;
-      retval(1) = ier;
-      retval(0) = val;
+      retval = ovl (val, ier, nfun, abserr);
     }
 
   if (fcn_name.length ())
