diff --git a/eisgenerator/eistype.h b/eisgenerator/eistype.h
index 595ecb870ef221827cb82928da22b5317a46383c..622404723f00b41347e8ea25968d17f4b71c70a9 100644
--- a/eisgenerator/eistype.h
+++ b/eisgenerator/eistype.h
@@ -7,10 +7,15 @@ typedef double fvalue;
 
 namespace eis
 {
-struct DataPoint
+class DataPoint
 {
+public:
 	std::complex<fvalue> im;
 	fvalue omega;
+	bool operator==(const DataPoint& in)
+	{
+		return im == in.im;
+	}
 };
 
 class Range
@@ -32,7 +37,6 @@ public:
 	{
 		return at(step);
 	}
-
 	fvalue at(size_t index) const
 	{
 		assert(index < count);
@@ -69,6 +73,8 @@ public:
 	static std::vector<Range> rangesFromParamString(const std::string& paramStr, size_t count);
 };
 
-bool saveToDisk(const std::vector<DataPoint>& data, std::string fileName);
+bool saveToDisk(const std::vector<DataPoint>& data, const std::string& fileName, std::string headStr = "");
+
+double eisDistance(const std::vector<eis::DataPoint>& a, const std::vector<eis::DataPoint>& b);
 
 }
diff --git a/eistype.cpp b/eistype.cpp
index 148487bcb6b5ffa4d0018a23af101bc11e6b946b..6276fdd97145122f59206c7c3311c888763c1599 100644
--- a/eistype.cpp
+++ b/eistype.cpp
@@ -7,7 +7,7 @@
 
 using namespace eis;
 
-bool eis::saveToDisk(const std::vector<DataPoint>& data, std::string fileName)
+bool eis::saveToDisk(const std::vector<DataPoint>& data, const std::string& fileName, std::string headStr)
 {
 	std::fstream file;
 	file.open(fileName, std::ios_base::out | std::ios_base::trunc);
@@ -17,6 +17,8 @@ bool eis::saveToDisk(const std::vector<DataPoint>& data, std::string fileName)
 		return false;
 	}
 
+	if(!headStr.empty())
+		file<<headStr<<'\n';
 	file<<"omega,real,im\n";
 
 	for(const eis::DataPoint& point : data)
@@ -92,3 +94,17 @@ bool eis::Range::isSane() const
 		return false;
 	return true;
 }
+
+double eis::eisDistance(const std::vector<eis::DataPoint>& a, const std::vector<eis::DataPoint>& b)
+{
+	assert(a.size() == b.size());
+
+	double accum = 0;
+	for(size_t i = 0; i < a.size(); ++i)
+	{
+		double diffRe = std::pow(b[i].im.real() - a[i].im.real(), 2);
+		double diffIm = std::pow(b[i].im.imag() - a[i].im.imag(), 2);
+		accum += std::sqrt(diffRe+diffIm);
+	}
+	return accum/a.size();
+}