diff --git a/alib2/src/regexp/Alternation.cpp b/alib2/src/regexp/Alternation.cpp
index d12fce3d4cf23d9f482e59bb6931873b7ba7a844..67bc56459aba13daf6dac4610a95b3aef324bb74 100644
--- a/alib2/src/regexp/Alternation.cpp
+++ b/alib2/src/regexp/Alternation.cpp
@@ -16,7 +16,7 @@ Alternation::Alternation() {
 
 Alternation::Alternation(const Alternation& other) {
 	for (const auto& element : other.elements) {
-		elements.insert(element->clone());
+		elements.push_back(element->clone());
 	}
 }
 
@@ -47,16 +47,16 @@ Alternation::~Alternation() noexcept {
 	elements.clear();
 }
 
-const std::set<const RegExpElement*, RegExpElement::PointerLess > & Alternation::getElements() const {
-	return * reinterpret_cast<const std::set<const RegExpElement*, RegExpElement::PointerLess > * > (&elements);
+const std::vector<const RegExpElement*> & Alternation::getElements() const {
+	return * reinterpret_cast<const std::vector<const RegExpElement*> * > (&elements);
 }
 
-void Alternation::insertElement(const RegExpElement& element) {
-	this->elements.insert(element.clone());
+void Alternation::appendElement(const RegExpElement& element) {
+	this->elements.push_back(element.clone());
 }
 
-void Alternation::insertElement(RegExpElement&& element) {
-	this->elements.insert(std::move(element).plunder());
+void Alternation::appendElement(RegExpElement&& element) {
+	this->elements.push_back(std::move(element).plunder());
 }
 
 RegExpElement* Alternation::clone() const {
diff --git a/alib2/src/regexp/Alternation.h b/alib2/src/regexp/Alternation.h
index da272b9ac3aa26475a86b7852ff5145c5cae48f6..3b9479f036e47e51a8413f8f1ebeec41aa704af4 100644
--- a/alib2/src/regexp/Alternation.h
+++ b/alib2/src/regexp/Alternation.h
@@ -8,7 +8,7 @@
 #ifndef ALTERNATION_H_
 #define ALTERNATION_H_
 
-#include <set>
+#include <vector>
 #include "RegExpElement.h"
 
 namespace regexp {
@@ -24,9 +24,12 @@ protected:
 	 */
 	virtual RegExpElement* clone() const;
 	
+	/**
+	 * @copydoc RegExpElement::plunder() const
+	 */
 	virtual RegExpElement* plunder() &&;
 
-	std::set<RegExpElement*, RegExpElement::PointerLess > elements;
+	std::vector<RegExpElement*> elements;
 public:
 	Alternation();
 	Alternation(const Alternation& other);
@@ -38,15 +41,17 @@ public:
 	/**
 	 * @return elements
 	 */
-	//TODO mozna vratit vector aby slo reprezentovat a+a, optimalizace nechat na tomasovi
-	const std::set<const RegExpElement*, RegExpElement::PointerLess > & getElements() const;
+	const std::vector<const RegExpElement*> & getElements() const;
 
 	/**
-	 * @param element to insert
+	 * @param element to append
 	 */
-	void insertElement(const RegExpElement& element);
-	
-	void insertElement(RegExpElement&& element);
+	void appendElement(const RegExpElement& element);
+
+	/**
+	 * @param element to append
+	 */
+	void appendElement(RegExpElement&& element);
 
 	virtual bool operator<(const RegExpElement&) const;
 	virtual bool operator==(const RegExpElement&) const;
diff --git a/alib2/src/regexp/RegExpFromStringParser.cpp b/alib2/src/regexp/RegExpFromStringParser.cpp
index 49b7ab4d7c95e3d71c4bf6b772fa8a9bea20b72a..7be14d866ce5efb5077a55ed9835f75ca37fde6a 100644
--- a/alib2/src/regexp/RegExpFromStringParser.cpp
+++ b/alib2/src/regexp/RegExpFromStringParser.cpp
@@ -24,27 +24,32 @@ RegExpElement* RegExpFromStringParser::alternationCont(RegExpElement* left) {
   RegExpFromStringLexer::Token token = m_Lexer.token();
   if(token.type == RegExpFromStringLexer::PLUS) {
     m_Lexer.next();
-    Alternation* res = this->alternationContCont(this->concatenation());
-    res->insertElement(std::move(*left));
+    
+    Alternation* res = new Alternation;
+    res->appendElement(std::move(*left));
     delete left;
-    return res;
+    
+    left = this->concatenation();
+    res->appendElement(std::move(*left));
+    delete left;
+    
+    return this->alternationContCont(res);
   } else {
     return left;
   }
 }
 
-Alternation* RegExpFromStringParser::alternationContCont(RegExpElement* left) {
+RegExpElement* RegExpFromStringParser::alternationContCont(Alternation* res) {
   RegExpFromStringLexer::Token token = m_Lexer.token();
   if(token.type == RegExpFromStringLexer::PLUS) {
     m_Lexer.next();
-    Alternation* res = this->alternationContCont(this->concatenation());
-    res->insertElement(std::move(*left));
-    delete left;
-    return res;
+    
+    RegExpElement* next = this->concatenation();
+    res->appendElement(std::move(*next));
+    delete next;
+    
+    return this->alternationContCont(res);
   } else {
-    Alternation* res = new Alternation();
-    res->insertElement(std::move(*left));
-    delete left;
     return res;
   }
 }
@@ -57,28 +62,31 @@ RegExpElement* RegExpFromStringParser::concatenation() {
 RegExpElement* RegExpFromStringParser::concatenationCont(RegExpElement* left) {
   RegExpFromStringLexer::Token token = m_Lexer.token();
   if(token.type == RegExpFromStringLexer::SYMBOL || token.type == RegExpFromStringLexer::LPAR || token.type == RegExpFromStringLexer::EPS || token.type == RegExpFromStringLexer::EMPTY) {
+
+    Concatenation* res = new Concatenation;
+    res->appendElement(std::move(*left));
+    delete left;
     
-    Concatenation* res = this->concatenationContCont(this->factor());
+    left = this->factor();
     res->appendElement(std::move(*left));
     delete left;
-    return res;
+    
+    return this->concatenationContCont(res);
   } else {
     return left;
   }
 }
 
-Concatenation* RegExpFromStringParser::concatenationContCont(RegExpElement* left) {
+RegExpElement* RegExpFromStringParser::concatenationContCont(Concatenation* res) {
   RegExpFromStringLexer::Token token = m_Lexer.token();
   if(token.type == RegExpFromStringLexer::SYMBOL || token.type == RegExpFromStringLexer::LPAR || token.type == RegExpFromStringLexer::EPS || token.type == RegExpFromStringLexer::EMPTY) {
     
-    Concatenation* res = this->concatenationContCont(this->factor());
-    res->appendElement(std::move(*left));
-    delete left;
-    return res;
+    RegExpElement* next = this->factor();
+    res->appendElement(std::move(*next));
+    delete next;
+    
+    return this->concatenationContCont(res);
   } else {
-    Concatenation* res = new Concatenation();
-    res->appendElement(std::move(*left));
-    delete left;
     return res;
   }
 }
diff --git a/alib2/src/regexp/RegExpFromStringParser.h b/alib2/src/regexp/RegExpFromStringParser.h
index 59e394e3fd396e53c1523a3172a0ddd71aefded4..b91969632ef4b3a960cd13d6aed9c547d071ed5c 100644
--- a/alib2/src/regexp/RegExpFromStringParser.h
+++ b/alib2/src/regexp/RegExpFromStringParser.h
@@ -18,11 +18,11 @@ namespace regexp {
 class RegExpFromStringParser {
 	RegExpElement* alternation();
 	RegExpElement* alternationCont(RegExpElement* left);
-	Alternation* alternationContCont(RegExpElement* left);
+	RegExpElement* alternationContCont(Alternation* left);
 	
 	RegExpElement* concatenation();
 	RegExpElement* concatenationCont(RegExpElement* left);
-	Concatenation* concatenationContCont(RegExpElement* left);
+	RegExpElement* concatenationContCont(Concatenation* left);
 	
 	RegExpElement* factor();
 	RegExpElement* star(RegExpElement* elem);
diff --git a/alib2/src/regexp/RegExpFromXMLParser.cpp b/alib2/src/regexp/RegExpFromXMLParser.cpp
index 50d7eff2013a978b6d8ea91bf75c53695e12df6f..0e83087202aa77f6e5a16d8836d146699b1587f7 100644
--- a/alib2/src/regexp/RegExpFromXMLParser.cpp
+++ b/alib2/src/regexp/RegExpFromXMLParser.cpp
@@ -46,7 +46,7 @@ Alternation* RegExpFromXMLParser::parseAlternation(std::list<sax::Token>& input)
 	while (true) {
 		RegExpElement* element = parseElement(input);
 		if(!element) break;
-		alternation->insertElement(std::move(*element));
+		alternation->appendElement(std::move(*element));
 		delete element;
 	}