diff --git a/src/avalanche/gistools/gridfile.C b/src/avalanche/gistools/gridfile.C
index cbbc76cf0609064812017920d57b26f72c16e549..0b77d9809e736672050024e378ef1d72fdec005e 100644
--- a/src/avalanche/gistools/gridfile.C
+++ b/src/avalanche/gistools/gridfile.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2019-2020 Matthias Rauter
+    Copyright (C) 2019-2022 Matthias Rauter
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -34,7 +34,6 @@ Author
 #include <sstream>
 #include <limits>
 #include <cmath>
-#include <regex>
 
 // Debugging output
 #undef  DebugInfo
@@ -154,11 +153,11 @@ int gridfile::read(const std::string& fname)
     std::ifstream pFile(filename_);
     if (!pFile.is_open())
     {
+        DebugInfo << "Cannot open file \"" << filename_ << "\"" << std::endl;
         return 0;
     }
 
     std::string line;
-    std::smatch match;
 
     bool readheader = true;
 
@@ -167,54 +166,61 @@ int gridfile::read(const std::string& fname)
     {
         std::getline(pFile, line);
 
-        if (std::regex_match(line, match, std::regex("^ncols\\s*(\\S*)$")))
+        std::string::size_type i = std::string::npos;
+
+        if ((i = line.find("ncols")) != std::string::npos)
         {
-            this->ncols_ = std::stod(match[1]);
+            this->ncols_ = std::stod(line.substr(i + 5));
         }
-        else if (std::regex_match(line, match, std::regex("^nrows\\s*(\\S*)$")))
+        else if ((i = line.find("nrows")) != std::string::npos)
         {
-            this->nrows_ = std::stod(match[1]);
+            this->nrows_ = std::stod(line.substr(i + 5));
         }
-        else if (std::regex_match(line, match, std::regex("^xllcorner\\s*(\\S*)$")))
+        else if ((i = line.find("xllcorner")) != std::string::npos)
         {
             offsetFromCornerToCenter = true;
-            this->xllcenter_ = std::stod(match[1]);
+            this->xllcenter_ = std::stod(line.substr(i + 9));
         }
-        else if (std::regex_match(line, match, std::regex("^xllcenter\\s*(\\S*)$")))
+        else if ((i = line.find("xllcenter")) != std::string::npos)
         {
-            this->xllcenter_ = std::stod(match[1]);
+            this->xllcenter_ = std::stod(line.substr(i + 9));
         }
-        else if (std::regex_match(line, match, std::regex("^yllcorner\\s*(\\S*)$")))
+        else if ((i = line.find("yllcorner")) != std::string::npos)
         {
             offsetFromCornerToCenter = true;
-            this->yllcenter_ = std::stod(match[1]);
+            this->yllcenter_ = std::stod(line.substr(i + 9));
         }
-        else if (std::regex_match(line, match, std::regex("^yllcenter\\s*(\\S*)$")))
+        else if ((i = line.find("yllcenter")) != std::string::npos)
         {
-            this->yllcenter_ = std::stod(match[1]);
+            this->yllcenter_ = std::stod(line.substr(i + 9));
         }
-        else if (std::regex_match(line, match, std::regex("^cellsize\\s*(\\S*)$")))
+        else if ((i = line.find("cellsize")) != std::string::npos)
         {
-            this->dx_ = std::stod(match[1]);
-            this->dy_ = std::stod(match[1]);
+            this->dx_ = std::stod(line.substr(i + 8));
+            this->dy_ = std::stod(line.substr(i + 8));
         }
-        else if (std::regex_match(line, match, std::regex("^dx\\s*(\\S*)$")))
+        else if ((i = line.find("dx")) != std::string::npos)
         {
-            this->dx_ = std::stod(match[1]);
+            this->dx_ = std::stod(line.substr(i + 2));
         }
-        else if (std::regex_match(line, match, std::regex("^dy\\s*(\\S*)$")))
+        else if ((i = line.find("dy")) != std::string::npos)
         {
-            this->dy_ = std::stod(match[1]);
+            this->dy_ = std::stod(line.substr(i + 2));
         }
-        else if (std::regex_match(line, match, std::regex("^NODATA_value\\s*(\\S*)$")))
+        else if ((i = line.find("NODATA_value")) != std::string::npos)
         {
-            this->NODATA_value_ = std::stod(match[1]);
+            this->NODATA_value_ = std::stod(line.substr(i + 12));
             readheader = false;
         }
+        else
+        {
+            DebugInfo << "Skipping line  " << line << std::endl;
+        }
     }
 
     if (this->ncols_ < 1 || this->nrows_ < 1)
     {
+        DebugInfo << "Number of columns (" << this->ncols_  << ") or number of rows (" << this->nrows_ << ") invalid." << std::endl;
         return 0;
     }
 
@@ -233,7 +239,6 @@ int gridfile::read(const std::string& fname)
 
     unsigned int i = 0, j = 0;
 
-    std::regex e("(\\S+)");
     while(!pFile.eof() && i < this->nrows_)
     {
         DebugInfo << "Reading line " << i << "/" << this->nrows_ << std::endl;
@@ -241,6 +246,7 @@ int gridfile::read(const std::string& fname)
         std::getline(pFile, line);
         j = 0;
 #if 0
+        std::regex e("(\\S+)");
         // The following part is very flexible but slow
         while (std::regex_search (line, match, e) and j < this->ncols) {
             try