diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc
index c86e18c3bf96e532013f9b50ee751fd8913a409f..e0c4fe7647e1adbe22a30faa8ca3412997bc5693 100644
--- a/src/one-body-sample.cc
+++ b/src/one-body-sample.cc
@@ -140,10 +140,9 @@ void assemble_frictional(
 }
 
 template <class VectorType, class MatrixType>
-void assemble_nonlinearity(
+Dune::shared_ptr<Dune::GlobalNonlinearity<VectorType, MatrixType> const>
+assemble_nonlinearity(
     int size, Dune::ParameterTree const &parset,
-    Dune::shared_ptr<Dune::GlobalNonlinearity<VectorType, MatrixType> const> &
-        myGlobalNonlinearity,
     Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
         nodalIntegrals) {
   typedef Dune::BlockVector<Dune::FieldVector<double, 1>> SingletonVectorType;
@@ -164,11 +163,11 @@ void assemble_nonlinearity(
     auto eta = Dune::make_shared<SingletonVectorType>(size);
     *eta = parset.get<double>("boundary.friction.eta");
 
-    myGlobalNonlinearity = Dune::make_shared<
+    return Dune::make_shared<
         Dune::GlobalRuinaNonlinearity<VectorType, MatrixType> const>(
         nodalIntegrals, a, mu, eta, normalStress);
   } else if (friction_model == std::string("Laursen")) {
-    myGlobalNonlinearity = Dune::make_shared<Dune::GlobalLaursenNonlinearity<
+    return Dune::make_shared<Dune::GlobalLaursenNonlinearity<
         Dune::LinearFunction, VectorType, MatrixType> const>(mu, normalStress,
                                                              nodalIntegrals);
   } else {
@@ -272,11 +271,8 @@ int main(int argc, char *argv[]) {
     assemble_frictional<GridType, GridView, SmallVector, P1Basis>(
         leafView, p1Basis, frictionalNodes, *nodalIntegrals);
 
-    Dune::shared_ptr<Dune::GlobalNonlinearity<VectorType, OperatorType> const>
-    myGlobalNonlinearity;
-    assemble_nonlinearity<VectorType, OperatorType>(
-        grid->size(grid->maxLevel(), dim), parset, myGlobalNonlinearity,
-        nodalIntegrals);
+    auto myGlobalNonlinearity = assemble_nonlinearity<VectorType, OperatorType>(
+        grid->size(grid->maxLevel(), dim), parset, nodalIntegrals);
 
     // {{{ Set up TNNMG solver
     // linear iteration step components