diff --git a/aconvert.regexp/src/RegExpParser.cpp b/aconvert.regexp/src/RegExpParser.cpp
index 8ba459c5c18f3495c0a7085cd113c55d4c8a4f07..cf070c07a50f0e5645f7efbc6b84c1a737d58efe 100644
--- a/aconvert.regexp/src/RegExpParser.cpp
+++ b/aconvert.regexp/src/RegExpParser.cpp
@@ -19,23 +19,25 @@ regexp::RegExpElement* RegExpParser::AlternationCont(regexp::RegExpElement* left
   RegExpLexer::Token token = m_Lexer.token();
   if(token.type == RegExpLexer::PLUS) {
     m_Lexer.next();
-    regexp::Alternation* res = new regexp::Alternation();
-    res->getElements().push_back(left);
-    this->AlternationContCont(res, this->Concatenation());
+    regexp::Alternation* res = this->AlternationContCont(this->Concatenation());
+    res->getElements().push_front(left);
     return res;
   } else {
     return left;
   }
 }
 
-void RegExpParser::AlternationContCont(regexp::Alternation* res, regexp::RegExpElement* left) {
+regexp::Alternation* RegExpParser::AlternationContCont(regexp::RegExpElement* left) {
   RegExpLexer::Token token = m_Lexer.token();
   if(token.type == RegExpLexer::PLUS) {
     m_Lexer.next();
-    res->getElements().push_back(left);
-    this->AlternationContCont(res, this->Concatenation());
+    regexp::Alternation* res = this->AlternationContCont(this->Concatenation());
+    res->getElements().push_front(left);
+    return res;
   } else {
-    res->getElements().push_back(left);
+    regexp::Alternation* res = new regexp::Alternation();
+    res->getElements().push_front(left);
+    return res;
   }
 }
 
@@ -48,24 +50,25 @@ regexp::RegExpElement* RegExpParser::ConcatenationCont(regexp::RegExpElement* le
   RegExpLexer::Token token = m_Lexer.token();
   if(token.type == RegExpLexer::SYMBOL || token.type == RegExpLexer::LPAR || token.type == RegExpLexer::EPS || token.type == RegExpLexer::EMPTY) {
     
-    regexp::Concatenation* res = new regexp::Concatenation();
-    res->getElements().push_back(left);
-    this->ConcatenationContCont(res, this->Factor());
+    regexp::Concatenation* res = this->ConcatenationContCont(this->Factor());
+    res->getElements().push_front(left);
     return res;
   } else {
     return left;
   }
 }
 
-void RegExpParser::ConcatenationContCont(regexp::Concatenation* res, regexp::RegExpElement* left) {
+regexp::Concatenation* RegExpParser::ConcatenationContCont(regexp::RegExpElement* left) {
   RegExpLexer::Token token = m_Lexer.token();
   if(token.type == RegExpLexer::SYMBOL || token.type == RegExpLexer::LPAR || token.type == RegExpLexer::EPS || token.type == RegExpLexer::EMPTY) {
     
-    res->getElements().push_back(left);
-    this->ConcatenationContCont(res, this->Factor());
+    regexp::Concatenation* res = this->ConcatenationContCont(this->Factor());
+    res->getElements().push_front(left);
+    return res;
   } else {
-    
-    res->getElements().push_back(left);
+    regexp::Concatenation* res = new regexp::Concatenation();
+    res->getElements().push_front(left);
+    return res;
   }
 }
 
diff --git a/aconvert.regexp/src/RegExpParser.h b/aconvert.regexp/src/RegExpParser.h
index 0177ccaaaa24b95d9a00c0972ccd4d25b5a617f9..37e161181ed622b7a7e70e797c04ebab9f15f2b1 100644
--- a/aconvert.regexp/src/RegExpParser.h
+++ b/aconvert.regexp/src/RegExpParser.h
@@ -26,11 +26,11 @@ public:
 private:
   regexp::RegExpElement* Alternation();
   regexp::RegExpElement* AlternationCont(regexp::RegExpElement* left);
-  void AlternationContCont(regexp::Alternation* res, regexp::RegExpElement* left);
+  regexp::Alternation* AlternationContCont(regexp::RegExpElement* left);
   
   regexp::RegExpElement* Concatenation();
   regexp::RegExpElement* ConcatenationCont(regexp::RegExpElement* left);
-  void ConcatenationContCont(regexp::Concatenation* res, regexp::RegExpElement* left);
+  regexp::Concatenation* ConcatenationContCont(regexp::RegExpElement* left);
   
   regexp::RegExpElement* Factor();
   regexp::RegExpElement* Star(regexp::RegExpElement* elem);
diff --git a/alib/src/RegExpFactory.h b/alib/src/RegExpFactory.h
index de6d8f64306ce91aa74774f5a0b73fc262baa183..510ddddc1d867800f3824fc8c9cf52ae5a28ef34 100644
--- a/alib/src/RegExpFactory.h
+++ b/alib/src/RegExpFactory.h
@@ -8,8 +8,6 @@
 #ifndef REGEXPFACTORY_H_
 #define REGEXPFACTORY_H_
 
-#include <list>
-
 #include "sax/Token.h"
 #include "regexp/RegExp.h"
 
diff --git a/alib/src/regexp/Alternation.cpp b/alib/src/regexp/Alternation.cpp
index 2bd801d82e6de887b1930000524de75c4f6372e8..1c557224ef201ca8c1e2ab5ee399b75924b13457 100644
--- a/alib/src/regexp/Alternation.cpp
+++ b/alib/src/regexp/Alternation.cpp
@@ -42,11 +42,11 @@ Alternation::~Alternation() {
 	elements.clear();
 }
 
-vector<RegExpElement*>& Alternation::getElements() {
+list<RegExpElement*>& Alternation::getElements() {
 	return elements;
 }
 
-const vector<RegExpElement*>& Alternation::getElements() const {
+const list<RegExpElement*>& Alternation::getElements() const {
 	return elements;
 }
 
diff --git a/alib/src/regexp/Alternation.h b/alib/src/regexp/Alternation.h
index 3ce18a9049fc30331c39f91ab91f558754a1883b..52b8f8c184f0c2255d188bf0c8246e247d36ffb8 100644
--- a/alib/src/regexp/Alternation.h
+++ b/alib/src/regexp/Alternation.h
@@ -8,7 +8,7 @@
 #ifndef ALTERNATION_H_
 #define ALTERNATION_H_
 
-#include <vector>
+#include <list>
 #include "RegExpElement.h"
 
 namespace regexp {
@@ -21,7 +21,7 @@ using namespace std;
  */
 class Alternation: public RegExpElement {
 private:
-	vector<RegExpElement*> elements;
+	list<RegExpElement*> elements;
 public:
 	Alternation();
 	Alternation(const Alternation& other);
@@ -31,12 +31,12 @@ public:
 	/**
 	 * @return list of operands
 	 */
-	vector<RegExpElement*>& getElements();
+	list<RegExpElement*>& getElements();
 
 	/**
 	 * @return list of operands
 	 */
-	const vector<RegExpElement*>& getElements() const;
+	const list<RegExpElement*>& getElements() const;
 
 	/**
 	 * @copydoc RegExpElement::clone() const
diff --git a/alib/src/regexp/Concatenation.cpp b/alib/src/regexp/Concatenation.cpp
index 0387d454fb5e21f7d06d347e48a40f753a6aceeb..c43e767dfd52427ce0667880013b4cab96d6cf7b 100644
--- a/alib/src/regexp/Concatenation.cpp
+++ b/alib/src/regexp/Concatenation.cpp
@@ -42,11 +42,11 @@ Concatenation::~Concatenation() {
 	elements.clear();
 }
 
-vector<RegExpElement*>& Concatenation::getElements() {
+list<RegExpElement*>& Concatenation::getElements() {
 	return elements;
 }
 
-const vector<RegExpElement*>& Concatenation::getElements() const {
+const list<RegExpElement*>& Concatenation::getElements() const {
 	return elements;
 }
 
diff --git a/alib/src/regexp/Concatenation.h b/alib/src/regexp/Concatenation.h
index 2e4713875fad7ac0aaef1d4a61fd03a4ac0c7583..9fead277d3acba1db41b8d4352fd87f643af69dd 100644
--- a/alib/src/regexp/Concatenation.h
+++ b/alib/src/regexp/Concatenation.h
@@ -8,7 +8,7 @@
 #ifndef CONCATENATION_H_
 #define CONCATENATION_H_
 
-#include <vector>
+#include <list>
 #include "RegExpElement.h"
 
 namespace regexp {
@@ -21,7 +21,7 @@ using namespace std;
  */
 class Concatenation: public RegExpElement {
 private:
-	vector<RegExpElement*> elements;
+	list<RegExpElement*> elements;
 public:
 	Concatenation();
 	Concatenation(const Concatenation& other);
@@ -31,12 +31,12 @@ public:
 	/**
 	 * @return list of operands
 	 */
-	vector<RegExpElement*>& getElements();
+	list<RegExpElement*>& getElements();
 
 	/**
 	 * @return list of operands
 	 */
-	const vector<RegExpElement*>& getElements() const;
+	const list<RegExpElement*>& getElements() const;
 
 	/**
 	 * @copydoc RegExpElement::clone() const
diff --git a/alib/src/regexp/Iteration.h b/alib/src/regexp/Iteration.h
index 4bca308eabb4bfdb40e6fca360debc9976648c3d..7466b2aedc4d440e2cd69eb8eb0ae3c939eb014c 100644
--- a/alib/src/regexp/Iteration.h
+++ b/alib/src/regexp/Iteration.h
@@ -8,6 +8,7 @@
 #ifndef ITERATION_H_
 #define ITERATION_H_
 
+#include <list>
 #include "RegExpElement.h"
 
 namespace regexp {
diff --git a/alib/src/regexp/RegExp.cpp b/alib/src/regexp/RegExp.cpp
index 27afc0cb913744b2fcd94073b5ea2d4c9d66aa89..621b00415264f179667d187fc98a9a04465a82b1 100644
--- a/alib/src/regexp/RegExp.cpp
+++ b/alib/src/regexp/RegExp.cpp
@@ -8,6 +8,8 @@
 #include "RegExp.h"
 #include "RegExpPrinter.h"
 
+#include <iostream>
+
 namespace regexp {
 
 RegExp::RegExp() {
diff --git a/alib/src/regexp/RegExp.h b/alib/src/regexp/RegExp.h
index ef21bad4b54a3c9391d41dcc2e373d191ab2fbcc..f16133cc5fa38305e2701f569705de2b5fca3317 100644
--- a/alib/src/regexp/RegExp.h
+++ b/alib/src/regexp/RegExp.h
@@ -8,8 +8,9 @@
 #ifndef REGEXP_H_
 #define REGEXP_H_
 
-#include <iostream>
-
+#include <vector>
+#include <list>
+#include <string>
 #include "RegExpElement.h"
 #include "RegExpEmpty.h"
 
diff --git a/alib/src/regexp/RegExpParser.cpp b/alib/src/regexp/RegExpParser.cpp
index 81d52a3987b38bda1033935bb9c6ba57775d381a..5bcad371450a35c23584ebbfc6d5e26ca3c80e05 100644
--- a/alib/src/regexp/RegExpParser.cpp
+++ b/alib/src/regexp/RegExpParser.cpp
@@ -68,7 +68,7 @@ Iteration* RegExpParser::parseIteration(list<Token>& input) {
 	return iteration;
 }
 
-void RegExpParser::parseContent(list<Token>& input, vector<RegExpElement*>& elements) {
+void RegExpParser::parseContent(list<Token>& input, list<RegExpElement*>& elements) {
 	while (true) {
 		RegExpElement* element = parseElement(input);
 		if(!element) return;
diff --git a/alib/src/regexp/RegExpParser.h b/alib/src/regexp/RegExpParser.h
index 808ad17d244a16d3bd70bae78e7b0487ac55a4d0..126f20ee5dc165c00e31a5f4424550d391ed9948 100644
--- a/alib/src/regexp/RegExpParser.h
+++ b/alib/src/regexp/RegExpParser.h
@@ -8,8 +8,6 @@
 #ifndef REGEXPPARSER_H_
 #define REGEXPPARSER_H_
 
-#include <list>
-
 #include "RegExp.h"
 #include "../sax/Token.h"
 #include "RegExpSymbol.h"
@@ -29,7 +27,7 @@ using namespace sax;
  */
 class RegExpParser {
 protected:
-	static void parseContent(list<Token>& input, vector<RegExpElement*>& elements);
+	static void parseContent(list<Token>& input, list<RegExpElement*>& elements);
 	static RegExpElement* parseElement(list<Token>& input);
 
 	static RegExpEpsilon* parseEpsilon(list<Token>& input);
diff --git a/alib/src/regexp/RegExpPrinter.cpp b/alib/src/regexp/RegExpPrinter.cpp
index f3757b302588ddd87ce45dbb45ed6fa7eafdb3b6..223ab546911f2e457c2a9f3558d7cc2da972c8b3 100644
--- a/alib/src/regexp/RegExpPrinter.cpp
+++ b/alib/src/regexp/RegExpPrinter.cpp
@@ -56,7 +56,7 @@ void RegExpPrinter::printElement(RegExpElement* element, ostream& out, string pr
 
 }
 
-void RegExpPrinter::printContent(vector<RegExpElement*>& content, ostream& out, string prefix) {
+void RegExpPrinter::printContent(list<RegExpElement*>& content, ostream& out, string prefix) {
 	for (auto element : content) {
 		printElement(element, out, prefix);
 	}
diff --git a/alib/src/regexp/RegExpPrinter.h b/alib/src/regexp/RegExpPrinter.h
index 33c21f8da4fd61a5b620af34a8ba2cf91a7d1ee6..49ba46d027298d068fde7355c487f239a57fc75e 100644
--- a/alib/src/regexp/RegExpPrinter.h
+++ b/alib/src/regexp/RegExpPrinter.h
@@ -28,7 +28,7 @@ class RegExpPrinter {
 protected:
 	static const string INDENTATION;
 	static void printElement(RegExpElement* element, ostream& out, string prefix);
-	static void printContent(vector<RegExpElement*>& content, ostream& out, string prefix);
+	static void printContent(list<RegExpElement*>& content, ostream& out, string prefix);
 	static void printAlternation(Alternation* alternation, ostream& out, string prefix);
 	static void printConcatenation(Concatenation* concatenation, ostream& out, string prefix);