diff --git a/alib2data/src/rte/formal/FormalRTEAlternation.cpp b/alib2data/src/rte/formal/FormalRTEAlternation.cpp
index 31b5de9617f498be195e259839bc4e8f45ee57c4..4e460103e49c6577c78210492473461da875f402 100644
--- a/alib2data/src/rte/formal/FormalRTEAlternation.cpp
+++ b/alib2data/src/rte/formal/FormalRTEAlternation.cpp
@@ -68,13 +68,7 @@ FormalRTEElement & FormalRTEAlternation::getRightElement ( ) {
 }
 
 void FormalRTEAlternation::setLeftElement ( const FormalRTEElement & element ) {
-	FormalRTEElement * elem = element.clone ( );
-
-	if ( this->parentRTE && !elem->attachRTE ( this->parentRTE ) )
-		throw exception::CommonException ( "Input symbols not in the alphabet." );
-
-	delete left;
-	this->left = elem;
+	setLeftElement ( std::move_copy ( element ) );
 }
 
 void FormalRTEAlternation::setLeftElement ( FormalRTEElement && element ) {
@@ -88,13 +82,7 @@ void FormalRTEAlternation::setLeftElement ( FormalRTEElement && element ) {
 }
 
 void FormalRTEAlternation::setRightElement ( const FormalRTEElement & element ) {
-	FormalRTEElement * elem = element.clone ( );
-
-	if ( this->parentRTE && !elem->attachRTE ( this->parentRTE ) )
-		throw exception::CommonException ( "Input symbols not in the alphabet." );
-
-	delete right;
-	this->right = elem;
+	setRightElement ( std::move_copy ( element ) );
 }
 
 void FormalRTEAlternation::setRightElement ( FormalRTEElement && element ) {
diff --git a/alib2data/src/rte/formal/FormalRTEIteration.cpp b/alib2data/src/rte/formal/FormalRTEIteration.cpp
index 72f6b50a01f1eefbf8bf4f9bccb5d5eea3e097c6..8a719c8cda2bc07ebf209f26a7d2dc7433f49bc9 100644
--- a/alib2data/src/rte/formal/FormalRTEIteration.cpp
+++ b/alib2data/src/rte/formal/FormalRTEIteration.cpp
@@ -64,13 +64,7 @@ FormalRTESymbol & FormalRTEIteration::getSubstitutionSymbol ( ) {
 }
 
 void FormalRTEIteration::setElement ( const FormalRTEElement & element ) {
-	FormalRTEElement * elem = element.clone ( );
-
-	if ( this->parentRTE && !this->element->attachRTE ( this->parentRTE ) )
-		throw exception::CommonException ( "Input symbols not in the alphabet." );
-
-	delete this->element;
-	this->element = elem;
+	setElement ( std::move_copy ( element ) );
 }
 
 void FormalRTEIteration::setElement ( FormalRTEElement && element ) {
@@ -83,11 +77,7 @@ void FormalRTEIteration::setElement ( FormalRTEElement && element ) {
 	this->element = elem;
 }
 
-void FormalRTEIteration::setSubstitutionSymbol ( const FormalRTESymbol & substitutionSymbol ) {
-	this->substitutionSymbol = substitutionSymbol.clone ( );
-}
-
-void FormalRTEIteration::setSubstitutionSymbol ( FormalRTESymbol && substitutionSymbol ) {
+void FormalRTEIteration::setSubstitutionSymbol ( FormalRTESymbol substitutionSymbol ) {
 	this->substitutionSymbol = std::move ( substitutionSymbol ).plunder ( );
 }
 
@@ -108,7 +98,12 @@ FormalRTEIteration * FormalRTEIteration::plunder ( ) && {
  * }
  */
 int FormalRTEIteration::compare ( const FormalRTEIteration & other ) const {
-	return element->compare ( * other.element );
+	auto first = std::tie ( getElement ( ), getSubstitutionSymbol ( ) );
+	auto second = std::tie ( other.getElement ( ), other.getSubstitutionSymbol ( ) );
+
+	std::compare < decltype ( first ) > comp;
+
+	return comp ( first, second );
 }
 
 void FormalRTEIteration::operator >>( std::ostream & out ) const {
diff --git a/alib2data/src/rte/formal/FormalRTEIteration.h b/alib2data/src/rte/formal/FormalRTEIteration.h
index 4b228bfe2a02aa8a1de086dd3e0345e328872725..e48bc6c049b8bcecd3b99a7b53b4474367c42934 100644
--- a/alib2data/src/rte/formal/FormalRTEIteration.h
+++ b/alib2data/src/rte/formal/FormalRTEIteration.h
@@ -85,8 +85,7 @@ public:
 	void setElement ( const FormalRTEElement & element );
 	void setElement ( FormalRTEElement && element );
 
-	void setSubstitutionSymbol ( const FormalRTESymbol & element );
-	void setSubstitutionSymbol ( FormalRTESymbol && element );
+	void setSubstitutionSymbol ( FormalRTESymbol element );
 
 	virtual int compare ( const FormalRTEElement & other ) const {
 		if ( std::type_index ( typeid ( * this ) ) == std::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other );
diff --git a/alib2data/src/rte/formal/FormalRTESubstitution.cpp b/alib2data/src/rte/formal/FormalRTESubstitution.cpp
index 16151201fce5330dab0fa22541196c3a357453da..c002c433678fe7a81785382536dd955f4ce80069 100644
--- a/alib2data/src/rte/formal/FormalRTESubstitution.cpp
+++ b/alib2data/src/rte/formal/FormalRTESubstitution.cpp
@@ -78,13 +78,7 @@ FormalRTESymbol & FormalRTESubstitution::getSubstitutionSymbol ( ) {
 }
 
 void FormalRTESubstitution::setLeftElement ( const FormalRTEElement & element ) {
-	FormalRTEElement * elem = element.clone ( );
-
-	if ( this->parentRTE && !elem->attachRTE ( this->parentRTE ) )
-		throw exception::CommonException ( "Input symbols not in the alphabet." );
-
-	delete left;
-	this->left = elem;
+	setLeftElement ( std::move_copy ( element ) );
 }
 
 void FormalRTESubstitution::setLeftElement ( FormalRTEElement && element ) {
@@ -98,13 +92,7 @@ void FormalRTESubstitution::setLeftElement ( FormalRTEElement && element ) {
 }
 
 void FormalRTESubstitution::setRightElement ( const FormalRTEElement & element ) {
-	FormalRTEElement * elem = element.clone ( );
-
-	if ( this->parentRTE && !elem->attachRTE ( this->parentRTE ) )
-		throw exception::CommonException ( "Input symbols not in the alphabet." );
-
-	delete left;
-	this->right = elem;
+	setRightElement ( std::move_copy ( element ) );
 }
 
 void FormalRTESubstitution::setRightElement ( FormalRTEElement && element ) {
@@ -117,11 +105,7 @@ void FormalRTESubstitution::setRightElement ( FormalRTEElement && element ) {
 	this->right = elem;
 }
 
-void FormalRTESubstitution::setSubstitutionSymbol ( const FormalRTESymbol & substitutionSymbol ) {
-	this->substitutionSymbol = substitutionSymbol.clone ( );
-}
-
-void FormalRTESubstitution::setSubstitutionSymbol ( FormalRTESymbol && substitutionSymbol ) {
+void FormalRTESubstitution::setSubstitutionSymbol ( FormalRTESymbol substitutionSymbol ) {
 	this->substitutionSymbol = std::move ( substitutionSymbol ).plunder ( );
 }
 
@@ -149,11 +133,12 @@ FormalRTESubstitution * FormalRTESubstitution::plunder ( ) && {
 }
 
 int FormalRTESubstitution::compare ( const FormalRTESubstitution & other ) const {
-	int res = left->compare ( * other.left );
+	auto first = std::tie ( getLeftElement ( ), getRightElement ( ), getSubstitutionSymbol ( ) );
+	auto second = std::tie ( other.getLeftElement ( ), other.getRightElement ( ), other.getSubstitutionSymbol ( ) );
 
-	if ( res == 0 ) res = right->compare ( * other.right );
+	std::compare < decltype ( first ) > comp;
 
-	return res;
+	return comp ( first, second );
 }
 
 void FormalRTESubstitution::operator >>( std::ostream & out ) const {
diff --git a/alib2data/src/rte/formal/FormalRTESubstitution.h b/alib2data/src/rte/formal/FormalRTESubstitution.h
index c8cee7c51366a685cc78835b96567d9848ea48f9..835078bc9ee6d4cc2ed8c3378640a3e8e8094f9d 100644
--- a/alib2data/src/rte/formal/FormalRTESubstitution.h
+++ b/alib2data/src/rte/formal/FormalRTESubstitution.h
@@ -85,8 +85,7 @@ public:
 	void setRightElement ( const FormalRTEElement & element );
 	void setRightElement ( FormalRTEElement && element );
 
-	void setSubstitutionSymbol ( const FormalRTESymbol & element );
-	void setSubstitutionSymbol ( FormalRTESymbol && element );
+	void setSubstitutionSymbol ( FormalRTESymbol element );
 
 	virtual int compare ( const FormalRTEElement & other ) const {
 		if ( std::type_index ( typeid ( * this ) ) == std::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other );
diff --git a/alib2data/src/rte/formal/FormalRTESymbol.cpp b/alib2data/src/rte/formal/FormalRTESymbol.cpp
index c7955055f40cac5f801a7e6de2f097de9c958ee0..ea7037cc82493c62fefd01a827afe3cef7c9c28f 100644
--- a/alib2data/src/rte/formal/FormalRTESymbol.cpp
+++ b/alib2data/src/rte/formal/FormalRTESymbol.cpp
@@ -93,27 +93,12 @@ bool operator ==( const alphabet::RankedSymbol & first, const FormalRTESymbol &
 }
 
 int FormalRTESymbol::compare ( const FormalRTESymbol & other ) const {
-	int res = this->symbol.compare ( other.symbol );
+	auto first = std::tie ( symbol, getElements ( ) );
+	auto second = std::tie ( symbol, other.getElements ( ) );
 
-	if ( res != 0 ) return res;
+	std::compare < decltype ( first ) > comp;
 
-	size_t thisSize	 = this->elements.size ( );
-	size_t otherSize = other.elements.size ( );
-
-	if ( thisSize < otherSize ) return -1;
-
-	if ( thisSize > otherSize ) return 1;
-
-	auto thisIter  = this->elements.begin ( );
-	auto otherIter = other.elements.begin ( );
-
-	for ( ; thisIter != this->elements.end ( ); ++thisIter, ++otherIter ) {
-		int res = ( * thisIter )->compare ( * * otherIter );
-
-		if ( res != 0 ) return res;
-	}
-
-	return 0;
+	return comp ( first, second );
 }
 
 void FormalRTESymbol::operator >>( std::ostream & out ) const {