diff --git a/alib2/src/regexp/Alternation.cpp b/alib2/src/regexp/Alternation.cpp
index 3140e27bc76216dfce12083029610ffa4387a89e..b70f17e4884425633fc192900abab58622dda612 100644
--- a/alib2/src/regexp/Alternation.cpp
+++ b/alib2/src/regexp/Alternation.cpp
@@ -93,10 +93,6 @@ bool Alternation::operator>(const RegExpElement& other) const {
 }
 
 
-bool Alternation::operator<(const Concatenation&) const {
-	return true;
-}
-
 bool Alternation::operator<(const Alternation& other) const {
 	int thisSize = this->elements.size();
 	int otherSize = other.elements.size();
@@ -113,6 +109,18 @@ bool Alternation::operator<(const Alternation& other) const {
 	return **thisIter < **otherIter;
 }
 
+bool Alternation::operator==(const Alternation& other) const {
+	if(this->elements.size() != other.elements.size()) return false;
+
+	auto thisIter = this->elements.begin();
+	auto otherIter = other.elements.begin();
+	for(; thisIter != this->elements.end(); thisIter++, otherIter++) {
+	  if(**thisIter != **otherIter) return false;
+	}
+
+	return true;
+}
+
 bool Alternation::testSymbol( const alphabet::Symbol & symbol ) const {
 	for(const auto& child : this->elements)
 		if(child->testSymbol(symbol)) return true;
@@ -131,18 +139,6 @@ void Alternation::computeMinimalAlphabet( std::set<alphabet::Symbol>& alphabet )
 		child->computeMinimalAlphabet(alphabet);
 }
 
-bool Alternation::operator==(const Alternation& other) const {
-	if(this->elements.size() != other.elements.size()) return false;
-
-	auto thisIter = this->elements.begin();
-	auto otherIter = other.elements.begin();
-	for(; thisIter != this->elements.end(); thisIter++, otherIter++) {
-	  if(**thisIter != **otherIter) return false;
-	}
-
-	return true;
-}
-
 void Alternation::operator>>(std::ostream& out) const {
 	out << "(Alternation";
 	for(const auto& e : elements)
diff --git a/alib2/src/regexp/Alternation.h b/alib2/src/regexp/Alternation.h
index dfece1ff417c117f51b39ec28019c4cd33c7b2c7..99bef9c72bd8c661bd389df19bdc039450ad2bf3 100644
--- a/alib2/src/regexp/Alternation.h
+++ b/alib2/src/regexp/Alternation.h
@@ -75,7 +75,6 @@ public:
 	virtual bool operator==(const RegExpElement&) const;
 	virtual bool operator>(const RegExpElement&) const;
 
-	virtual bool operator<(const Concatenation&) const;
 	virtual bool operator<(const Alternation&) const;
 	virtual bool operator==(const Alternation&) const;
 	
diff --git a/alib2/src/regexp/Iteration.cpp b/alib2/src/regexp/Iteration.cpp
index 7119754ecd49d4779f2581f5bb385b4b7e9903e0..b3b19fcc569cd8f235d5f0146b66b073b4c6bd19 100644
--- a/alib2/src/regexp/Iteration.cpp
+++ b/alib2/src/regexp/Iteration.cpp
@@ -87,14 +87,6 @@ bool Iteration::operator>(const RegExpElement& other) const {
 	return other < *this;
 }
 
-bool Iteration::operator<(const Concatenation&) const {
-	return true;
-}
-
-bool Iteration::operator<(const Alternation&) const {
-	return true;
-}
-
 bool Iteration::operator<(const Iteration& other) const {
 	return *(this->element) < *(other.element);
 }
diff --git a/alib2/src/regexp/Iteration.h b/alib2/src/regexp/Iteration.h
index 985e9d6505ad388c5152156693aeca765892471d..d1d21a7b2c12037256c497e017f5df064425ff72 100644
--- a/alib2/src/regexp/Iteration.h
+++ b/alib2/src/regexp/Iteration.h
@@ -69,8 +69,6 @@ public:
 	virtual bool operator==(const RegExpElement&) const;
 	virtual bool operator>(const RegExpElement&) const;
 
-	virtual bool operator<(const Concatenation&) const;
-	virtual bool operator<(const Alternation&) const;
 	virtual bool operator<(const Iteration&) const;
 	virtual bool operator==(const Iteration&) const;
 
diff --git a/alib2/src/regexp/RegExpElement.cpp b/alib2/src/regexp/RegExpElement.cpp
index bebb38e03e215d79b8a6d36203116f13ac8678bd..ae6a9ac24be1e4b5411c36e4836f93c3314de3c6 100644
--- a/alib2/src/regexp/RegExpElement.cpp
+++ b/alib2/src/regexp/RegExpElement.cpp
@@ -6,6 +6,9 @@
  */
 
 #include "RegExpElement.h"
+#include <typeinfo>
+
+#include "RegExpElements.h"
 
 namespace regexp {
 
@@ -31,27 +34,27 @@ bool RegExpElement::operator!=(const RegExpElement& other) const {
 
 
 bool RegExpElement::operator<(const Concatenation& other) const {
-	return false;
+	return typeid(this).before(typeid(other));
 }
 
 bool RegExpElement::operator<(const Alternation& other) const {
-	return false;
+	return typeid(this).before(typeid(other));
 }
 
 bool RegExpElement::operator<(const Iteration& other) const {
-	return false;
+	return typeid(this).before(typeid(other));
 }
 
 bool RegExpElement::operator<(const RegExpSymbol& other) const {
-	return false;
+	return typeid(this).before(typeid(other));
 }
 
 bool RegExpElement::operator<(const RegExpEpsilon& other) const {
-	return false;
+	return typeid(this).before(typeid(other));
 }
 
 bool RegExpElement::operator<(const RegExpEmpty& other) const {
-	return false;
+	return typeid(this).before(typeid(other));
 }
 
 
diff --git a/alib2/src/regexp/RegExpEmpty.cpp b/alib2/src/regexp/RegExpEmpty.cpp
index 916a7d1e720cc31dd820d7779fe28e4894e029f8..aac9838617725642cd61fc8acebd83feb11f9540 100644
--- a/alib2/src/regexp/RegExpEmpty.cpp
+++ b/alib2/src/regexp/RegExpEmpty.cpp
@@ -30,24 +30,8 @@ bool RegExpEmpty::operator>(const RegExpElement& other) const {
 }
 
 
-bool RegExpEmpty::operator<(const Concatenation&) const {
-	return true;
-}
-
-bool RegExpEmpty::operator<(const Alternation&) const {
-	return true;
-}
-
-bool RegExpEmpty::operator<(const Iteration&) const {
-	return true;
-}
-
-bool RegExpEmpty::operator<(const RegExpSymbol&) const {
-	return true;
-}
-
-bool RegExpEmpty::operator<(const RegExpEpsilon&) const {
-	return true;
+bool RegExpEmpty::operator<(const RegExpEmpty&) const {
+	return false;
 }
 
 bool RegExpEmpty::operator==(const RegExpEmpty&) const {
diff --git a/alib2/src/regexp/RegExpEmpty.h b/alib2/src/regexp/RegExpEmpty.h
index e0aa81e559cf21bf536ac7ab0e8a41ca7ffd02c8..52ec086c15a849d2c47d4c3f7740073c609ba74c 100644
--- a/alib2/src/regexp/RegExpEmpty.h
+++ b/alib2/src/regexp/RegExpEmpty.h
@@ -44,11 +44,7 @@ public:
 	virtual bool operator==(const RegExpElement&) const;
 	virtual bool operator>(const RegExpElement&) const;
 
-	virtual bool operator<(const Concatenation&) const;
-	virtual bool operator<(const Alternation&) const;
-	virtual bool operator<(const Iteration&) const;
-	virtual bool operator<(const RegExpSymbol&) const;
-	virtual bool operator<(const RegExpEpsilon&) const;
+	virtual bool operator<(const RegExpEmpty&) const;
 	virtual bool operator==(const RegExpEmpty&) const;
 	
 	/**
diff --git a/alib2/src/regexp/RegExpEpsilon.cpp b/alib2/src/regexp/RegExpEpsilon.cpp
index 7666137a6cb0581fc017e2db4731a1f1e7b2c895..eed1754a8c6a4dc61fb8ef55fa2a77eb462d4242 100644
--- a/alib2/src/regexp/RegExpEpsilon.cpp
+++ b/alib2/src/regexp/RegExpEpsilon.cpp
@@ -30,20 +30,8 @@ bool RegExpEpsilon::operator>(const RegExpElement& other) const {
 }
 
 
-bool RegExpEpsilon::operator<(const Alternation&) const {
-	  return true;
-}
-
-bool RegExpEpsilon::operator<(const Concatenation&) const {
-	  return true;
-}
-
-bool RegExpEpsilon::operator<(const Iteration&) const {
-	  return true;
-}
-
-bool RegExpEpsilon::operator<(const RegExpSymbol&) const {
-	  return true;
+bool RegExpEpsilon::operator<(const RegExpEpsilon&) const {
+	  return false;
 }
 
 bool RegExpEpsilon::operator==(const RegExpEpsilon&) const {
diff --git a/alib2/src/regexp/RegExpEpsilon.h b/alib2/src/regexp/RegExpEpsilon.h
index fed42e6d959b7033701f2c78acafc950b1566577..585bab24b86e3c1de6ebb0e5275a95fc9fb157f4 100644
--- a/alib2/src/regexp/RegExpEpsilon.h
+++ b/alib2/src/regexp/RegExpEpsilon.h
@@ -45,10 +45,7 @@ public:
 	virtual bool operator==(const RegExpElement&) const;
 	virtual bool operator>(const RegExpElement&) const;
 
-	virtual bool operator<(const Alternation&) const;
-	virtual bool operator<(const Concatenation&) const;
-	virtual bool operator<(const Iteration&) const;
-	virtual bool operator<(const RegExpSymbol&) const;
+	virtual bool operator<(const RegExpEpsilon&) const;
 	virtual bool operator==(const RegExpEpsilon&) const;
 	
 	/**
diff --git a/alib2/src/regexp/RegExpSymbol.cpp b/alib2/src/regexp/RegExpSymbol.cpp
index 53f759e7b2da0c238139c907ea2fdbb1d40de61f..c26c82b1a857218fbd143a2b4e4e750b14bae3a0 100644
--- a/alib2/src/regexp/RegExpSymbol.cpp
+++ b/alib2/src/regexp/RegExpSymbol.cpp
@@ -26,7 +26,11 @@ RegExpElement* RegExpSymbol::plunder() && {
 }
 
 bool RegExpSymbol::operator==(const alphabet::Symbol& other) const {
-	return *this == other;
+	return (const alphabet::Symbol&) *this == other;
+}
+
+bool operator==(const alphabet::Symbol& first, const RegExpSymbol& second) {
+	return first == (const alphabet::Symbol&) second;
 }
 
 bool RegExpSymbol::operator<(const RegExpElement& other) const {
@@ -42,18 +46,6 @@ bool RegExpSymbol::operator>(const RegExpElement& other) const {
 }
 
 
-bool RegExpSymbol::operator<(const Concatenation&) const {
-	return true;
-}
-
-bool RegExpSymbol::operator<(const Alternation&) const {
-	return true;
-}
-
-bool RegExpSymbol::operator<(const Iteration&) const {
-	return true;
-}
-
 bool RegExpSymbol::operator<(const RegExpSymbol& other) const {
 	return this->symbol < other.symbol;
 }
diff --git a/alib2/src/regexp/RegExpSymbol.h b/alib2/src/regexp/RegExpSymbol.h
index ed232bf89ae400a01b02a5e500147f0c3db06df7..653e84675a409e504b55a007e4f01b378068dc85 100644
--- a/alib2/src/regexp/RegExpSymbol.h
+++ b/alib2/src/regexp/RegExpSymbol.h
@@ -44,15 +44,13 @@ public:
 	RegExpSymbol(const std::string& symbol);
 	RegExpSymbol(std::string&& symbol);
 	
-	virtual bool operator==(const alphabet::Symbol&) const;
+	bool operator==(const alphabet::Symbol&) const;
+	friend bool operator==(const alphabet::Symbol&, const RegExpSymbol&);
 
 	virtual bool operator<(const RegExpElement&) const;
 	virtual bool operator==(const RegExpElement&) const;
 	virtual bool operator>(const RegExpElement&) const;
 
-	virtual bool operator<(const Concatenation&) const;
-	virtual bool operator<(const Alternation&) const;
-	virtual bool operator<(const Iteration&) const;
 	virtual bool operator<(const RegExpSymbol&) const;
 	virtual bool operator==(const RegExpSymbol&) const;