diff --git a/CMakeLists.txt b/CMakeLists.txt
index e529f27baad256898789603d74143400e7e0aad2..a1ae6cddbe2aed5ddcb14840c9d84356a0bcf844 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -103,7 +103,7 @@ else()
 	set(COMMON_LINK_FLAGS "-flto -ltbb -pthread")
 endif(WIN32)
 
-set(COMMON_COMPILE_FLAGS "-Wall -O2 -march=native -g")
+set(COMMON_COMPILE_FLAGS "-Wall -O3 -march=native -g")
 
 if(PROFILE_ENABLED)
 	message("Profileing enabled")
diff --git a/eisgenerator/model.h b/eisgenerator/model.h
index 230a8a7b744adf7b1dcb1406188d798a89bc3e44..7246919c0e58011637da7d89a5cb1572cd492930 100644
--- a/eisgenerator/model.h
+++ b/eisgenerator/model.h
@@ -308,6 +308,14 @@ public:
 	* @return A vector of indecies corresponding to the iso-difference spectras.
 	*/
 	std::vector<size_t> getRecommendedParamIndices(eis::Range omegaRange, double distance, bool threaded = false);
+
+
+	/**
+	* @brief Removes the series reistance from a model string (if any)
+	*
+	* @param model the model string from wich to remove the seires resitance
+	*/
+	static void removeSeriesResitance(std::string& model);
 };
 
 /**
diff --git a/main.cpp b/main.cpp
index 2609ba97c20a2f66c37317e3e160a053740b7304..4fcfd79ada75f62c47a8fd8902408830e382aa45 100644
--- a/main.cpp
+++ b/main.cpp
@@ -428,7 +428,6 @@ int main(int argc, char** argv)
 			else
 				runSweep(config, model);
 		}
-
 	}
 	catch(const std::invalid_argument& ia)
 	{
diff --git a/model.cpp b/model.cpp
index 9a764f31c7206df82507d06b8792b4282acf1c7f..eea3e4f4d2ee8876fb5d367007c6fbc37a1dedfb 100644
--- a/model.cpp
+++ b/model.cpp
@@ -26,15 +26,14 @@
 #include <sstream>
 #include <string>
 #include <vector>
-#include <array>
 #include <thread>
-#include <fstream>
 #include <algorithm>
 #include <execution>
 #include <dlfcn.h>
 #include <functional>
 
 #include "componant/componant.h"
+#include "componant/resistor.h"
 #include "eistype.h"
 #include "strops.h"
 #include "componant/paralellseriel.h"
@@ -732,3 +731,34 @@ std::string Model::getCompiledFunctionName() const
 {
 	return "model_"+std::to_string(getUuid());
 }
+
+void Model::removeSeriesResitance(std::string& model)
+{
+	for(size_t i = 0; i < model.size(); ++i)
+	{
+		if(model[i] == Resistor::staticGetComponantChar())
+		{
+			if((i == 0 || model[i-1] == '-') && (i == model.size()-1 || model[i+1] == '-' || model[i+1] == '{'))
+			{
+				if(i != model.size()-1 && model[i+1] == '{')
+				{
+					size_t close = opposingBraket(model, i+1, getOpposingBracketChar(model[i+1]));
+					if(close == model.size()-1 || model[close+1] == '-')
+					{
+						eraseModelElement(model, i);
+						i = 0;
+					}
+				}
+				else
+				{
+					eraseModelElement(model, i);
+					i = 0;
+				}
+			}
+		}
+		else if(model[i] == '(')
+		{
+			i = opposingBraket(model, i, getOpposingBracketChar(model[i]));
+		}
+	}
+}
diff --git a/strops.cpp b/strops.cpp
index f07098196a2a11552c273fc847a8e7dd033894d9..972afa25f01f8edaca81a09d11fe023af69645c4 100644
--- a/strops.cpp
+++ b/strops.cpp
@@ -207,6 +207,40 @@ size_t eisRemoveUnneededBrackets(std::string& in, long int bracketStart)
 	return in.size()-1;
 }
 
+void eraseModelElement(std::string& in, size_t index)
+{
+	size_t start = index;
+	size_t end = index+1;
+	while(start > 0)
+	{
+		if(in[start-1] != '-')
+			break;
+		--start;
+	}
+
+	while(end < in.size())
+	{
+		switch(in[end])
+		{
+			case '{':
+				end = opposingBraket(in, end, getOpposingBracketChar(in[end]))+1;
+				continue;
+			case '-':
+				++end;
+				continue;
+			default:
+				break;
+		}
+		break;
+	}
+
+	if(end < in.size() && in[start] == '-')
+		++start;
+
+
+	in.erase(in.begin()+start, in.begin()+end);
+}
+
 std::string stripWhitespace(const std::string& in)
 {
 	std::string out;
diff --git a/strops.h b/strops.h
index 6db94a2494586149bc80ae369a5efca910b2a60e..1dba84082812cc1725d3434ec48022d37f2b4eac 100644
--- a/strops.h
+++ b/strops.h
@@ -44,4 +44,6 @@ void stripQuotes(std::string& in);
 
 size_t eisRemoveUnneededBrackets(std::string& in, long int bracketStart = -1);
 
+void eraseModelElement(std::string& in, size_t index);
+
 }
diff --git a/test.cpp b/test.cpp
index 60a4ebf0ea319d730148a0fa2371ab5bd22a063d..f7a4b6b97fbc35ebf0157299658bfa5fdc4aa29c 100644
--- a/test.cpp
+++ b/test.cpp
@@ -497,6 +497,7 @@ bool testCompiledConsistancy(const std::string& modelstr)
 	const fvalue omega = 1e5;
 	eis::Model model(modelstr, 100, false);
 	std::complex<fvalue> a = model.execute(omega).im;
+	eis::Log(eis::Log::INFO)<<__func__<<" compileing "<<modelstr;
 	model.compile();
 	std::complex<fvalue> b = model.execute(omega).im;
 	if(!eis::fvalueEq(a.imag(), b.imag()) || !eis::fvalueEq(a.real(), b.real()))
@@ -507,6 +508,20 @@ bool testCompiledConsistancy(const std::string& modelstr)
 	return true;
 }
 
+bool testRemoveSeriesResistance()
+{
+	std::string model = "r-c-r-cr-rc(c-r-c)-r{1203}-r{11293}c-lrc";
+	eis::Model::removeSeriesResitance(model);
+	std::string expectedResult = "c-cr-rc(c-r-c)-r{11293}c-lrc";
+	if(model != expectedResult)
+	{
+		eis::Log(eis::Log::ERROR)<<__func__<<"Expected "<<expectedResult<<" got "<<model;
+		return false;
+	}
+
+	return true;
+}
+
 int main(int argc, char** argv)
 {
 	eis::Log::headers = true;
@@ -572,5 +587,8 @@ int main(int argc, char** argv)
 	if(!testCompiledConsistancy("r{50}-r{1000}p{1e-5, 0.9}"))
 		return 20;
 
+	if(!testRemoveSeriesResistance())
+		return 21;
+
 	return 0;
 }