diff --git a/alib2algo/src/arbology/exact/BorderArrayNaive.cpp b/alib2algo/src/arbology/exact/BorderArrayNaive.cpp
index 4ef26a2293ccf53a8d1f90db83318a2ea8838ff4..fe2aa756c3e22af3660211a6044377fed8ca8bb3 100644
--- a/alib2algo/src/arbology/exact/BorderArrayNaive.cpp
+++ b/alib2algo/src/arbology/exact/BorderArrayNaive.cpp
@@ -12,6 +12,7 @@
 #include <tree/ranked/PrefixRankedBarPattern.h>
 #include <tree/ranked/PrefixRankedPattern.h>
 #include <tree/Tree.h>
+#include <global/GlobalData.h>
 
 namespace arbology {
 
@@ -22,7 +23,7 @@ std::vector < size_t > BorderArrayNaive::ba ( const tree::Tree & pattern ) {
 }
 
 bool BorderArrayNaive::matches ( const tree::PrefixRankedBarPattern & pattern, const std::vector < int > & subtreeJumpTable, int stop, int offset ) {
-	unsigned i = 1;
+	unsigned i = 0;
 
 	while ( offset < stop && i < pattern.getContent ( ).size ( ) )
 		if ( pattern.getContent ( )[i] == pattern.getContent ( )[offset] ) {
@@ -59,13 +60,16 @@ std::vector < size_t > BorderArrayNaive::ba ( const tree::PrefixRankedBarPattern
 		res[i] = i - min;
 	}
 
+	if ( common::GlobalData::verbose )
+		std::clog << res << std::endl;
+
 	return res;
 }
 
 auto BorderArrayPrefixRankedBarPattern = BorderArrayNaive::RegistratorWrapper < std::vector < size_t >, tree::PrefixRankedBarPattern > ( BorderArrayNaive::getInstance ( ), BorderArrayNaive::ba );
 
 bool BorderArrayNaive::matches ( const tree::PrefixRankedPattern & pattern, const std::vector < int > & subtreeJumpTable, int stop, int offset ) {
-	unsigned i = 1;
+	unsigned i = 0;
 
 	while ( offset < stop && i < pattern.getContent ( ).size ( ) )
 		if ( pattern.getContent ( )[i] == pattern.getContent ( )[offset] ) {
@@ -102,6 +106,9 @@ std::vector < size_t > BorderArrayNaive::ba ( const tree::PrefixRankedPattern &
 		res[i] = i - min;
 	}
 
+	if ( common::GlobalData::verbose )
+		std::clog << res << std::endl;
+
 	return res;
 }
 
diff --git a/alib2algo/src/regexp/GlushkovTraversal.cpp b/alib2algo/src/regexp/GlushkovTraversal.cpp
index fa7c5bec08597dee891ebd7e5d6068cfd128d110..1ed62108ebd558c9947ff12120dca3683e91fbf0 100644
--- a/alib2algo/src/regexp/GlushkovTraversal.cpp
+++ b/alib2algo/src/regexp/GlushkovTraversal.cpp
@@ -9,428 +9,378 @@
 
 #include "properties/RegExpEpsilon.h"
 
-namespace regexp
-{
+namespace regexp {
 
-const GlushkovSymbol& GlushkovTraversal::findSymbol( regexp::UnboundedRegExpSymbol const * const symbol, const std::set<GlushkovSymbol> & symbolSet )
-{
-	auto it = find_if( symbolSet.begin( ), symbolSet.end( ), [ symbol ]( GlushkovSymbol const& gs ) -> bool {
-		return gs.getSymbolPtr( ) == symbol;
-	} );
+const GlushkovSymbol & GlushkovTraversal::findSymbol ( regexp::UnboundedRegExpSymbol const * const symbol, const std::set < GlushkovSymbol > & symbolSet ) {
+	auto it = find_if ( symbolSet.begin ( ), symbolSet.end ( ), [symbol] ( GlushkovSymbol const & gs ) -> bool {
+			return gs.getSymbolPtr ( ) == symbol;
+		} );
 
-	if( it == symbolSet.end( ) )
-		throw( "GlushkovTraversal - Can not find GlushkovSymbol for regexp node." );
+	if ( it == symbolSet.end ( ) )
+		throw ( "GlushkovTraversal - Can not find GlushkovSymbol for regexp node." );
 
 	return * it;
 }
 
-bool GlushkovTraversal::pos( GlushkovSymbol const& symbol, regexp::UnboundedRegExp const * const & node )
-{
-	return pos( & node->getRegExp(), symbol.getSymbolPtr( ) );
+bool GlushkovTraversal::pos ( GlushkovSymbol const & symbol, regexp::UnboundedRegExp const * const & node ) {
+	return pos ( & node->getRegExp ( ), symbol.getSymbolPtr ( ) );
 }
 
-std::set<GlushkovSymbol> GlushkovTraversal::first( regexp::UnboundedRegExp const& re )
-{
-	std::set<GlushkovSymbol> firstSet, symbolSet = getSymbols( re );
+std::set < GlushkovSymbol > GlushkovTraversal::first ( regexp::UnboundedRegExp const & re ) {
+	std::set < GlushkovSymbol > firstSet, symbolSet = getSymbols ( re );
 
-	for( auto const& s : first( & re.getRegExp() ) )
-		firstSet.insert( findSymbol( s, symbolSet ) );
+	for ( auto const & s : first ( & re.getRegExp ( ) ) )
+		firstSet.insert ( findSymbol ( s, symbolSet ) );
 
 	return firstSet;
 }
 
-std::set<GlushkovSymbol> GlushkovTraversal::last( regexp::UnboundedRegExp const& re )
-{
-	std::set<GlushkovSymbol> lastSet, symbolSet = getSymbols( re );
+std::set < GlushkovSymbol > GlushkovTraversal::last ( regexp::UnboundedRegExp const & re ) {
+	std::set < GlushkovSymbol > lastSet, symbolSet = getSymbols ( re );
 
-	for( auto const& s : last( & re.getRegExp() ) )
-		lastSet.insert( findSymbol( s, symbolSet ) );
+	for ( auto const & s : last ( & re.getRegExp ( ) ) )
+		lastSet.insert ( findSymbol ( s, symbolSet ) );
 
 	return lastSet;
 }
 
-std::set<GlushkovSymbol> GlushkovTraversal::follow( regexp::UnboundedRegExp const& re, GlushkovSymbol const& symbol )
-{
-	std::set<GlushkovSymbol> followSet, symbolSet = getSymbols( re );
+std::set < GlushkovSymbol > GlushkovTraversal::follow ( regexp::UnboundedRegExp const & re, GlushkovSymbol const & symbol ) {
+	std::set < GlushkovSymbol > followSet, symbolSet = getSymbols ( re );
 
-	for( auto const& s: follow( & re.getRegExp(), symbol.getSymbolPtr( ) ) )
-		followSet.insert( findSymbol( s, symbolSet ) );
+	for ( auto const & s : follow ( & re.getRegExp ( ), symbol.getSymbolPtr ( ) ) )
+		followSet.insert ( findSymbol ( s, symbolSet ) );
 
 	return followSet;
 }
 
 // -----------------------------------------------------------------------------
 
-std::set<regexp::UnboundedRegExpSymbol const *> GlushkovTraversal::first( regexp::UnboundedRegExpElement const * const & node )
-{
-	regexp::UnboundedRegExpAlternation const * const alternation = dynamic_cast<regexp::UnboundedRegExpAlternation const * const>( node );
-	regexp::UnboundedRegExpConcatenation const * const concatenation = dynamic_cast<regexp::UnboundedRegExpConcatenation const * const>( node );
-	regexp::UnboundedRegExpIteration const * const iteration = dynamic_cast<regexp::UnboundedRegExpIteration const * const>( node );
-	regexp::UnboundedRegExpSymbol const * const symbol = dynamic_cast<regexp::UnboundedRegExpSymbol const * const>( node );
-	regexp::UnboundedRegExpEmpty const * const empty = dynamic_cast<regexp::UnboundedRegExpEmpty const * const>( node );
-	regexp::UnboundedRegExpEpsilon const * const eps = dynamic_cast<regexp::UnboundedRegExpEpsilon const * const>( node );
-
-	if( alternation )
-		return first( alternation );
-	else if( concatenation )
-		return first( concatenation );
-	else if( iteration )
-		return first( iteration );
-	else if( eps )
-		return first( eps );
-	else if( empty )
-		return first( empty );
-	else if( symbol )
-		return first( symbol );
-
-	throw exception::AlibException( "GlushkovTraversal::first - invalid RegExpElement node" );
-}
-
-std::set<regexp::UnboundedRegExpSymbol const *> GlushkovTraversal::first( regexp::UnboundedRegExpAlternation const * const & node )
-{
-	std::set<regexp::UnboundedRegExpSymbol const *> ret, tmp;
-
-	for( auto const& element : node->getElements( ) )
-	{
-		tmp = first( element );
-		ret.insert( tmp.begin( ), tmp.end( ) );
+std::set < regexp::UnboundedRegExpSymbol const * > GlushkovTraversal::first ( regexp::UnboundedRegExpElement const * const & node ) {
+	regexp::UnboundedRegExpAlternation const * const alternation = dynamic_cast < regexp::UnboundedRegExpAlternation const * const > ( node );
+	regexp::UnboundedRegExpConcatenation const * const concatenation = dynamic_cast < regexp::UnboundedRegExpConcatenation const * const > ( node );
+	regexp::UnboundedRegExpIteration const * const iteration = dynamic_cast < regexp::UnboundedRegExpIteration const * const > ( node );
+	regexp::UnboundedRegExpSymbol const * const symbol = dynamic_cast < regexp::UnboundedRegExpSymbol const * const > ( node );
+	regexp::UnboundedRegExpEmpty const * const empty = dynamic_cast < regexp::UnboundedRegExpEmpty const * const > ( node );
+	regexp::UnboundedRegExpEpsilon const * const eps = dynamic_cast < regexp::UnboundedRegExpEpsilon const * const > ( node );
+
+	if ( alternation )
+		return first ( alternation );
+	else if ( concatenation )
+		return first ( concatenation );
+	else if ( iteration )
+		return first ( iteration );
+	else if ( eps )
+		return first ( eps );
+	else if ( empty )
+		return first ( empty );
+	else if ( symbol )
+		return first ( symbol );
+
+	throw exception::AlibException ( "GlushkovTraversal::first - invalid RegExpElement node" );
+}
+
+std::set < regexp::UnboundedRegExpSymbol const * > GlushkovTraversal::first ( regexp::UnboundedRegExpAlternation const * const & node ) {
+	std::set < regexp::UnboundedRegExpSymbol const * > ret, tmp;
+
+	for ( auto const & element : node->getElements ( ) ) {
+		tmp = first ( element );
+		ret.insert ( tmp.begin ( ), tmp.end ( ) );
 	}
 
 	return ret;
 }
 
-std::set<regexp::UnboundedRegExpSymbol const *> GlushkovTraversal::first( regexp::UnboundedRegExpConcatenation const * const & node )
-{
-	std::set<regexp::UnboundedRegExpSymbol const *> ret, tmp;
+std::set < regexp::UnboundedRegExpSymbol const * > GlushkovTraversal::first ( regexp::UnboundedRegExpConcatenation const * const & node ) {
+	std::set < regexp::UnboundedRegExpSymbol const * > ret, tmp;
 
-	for( auto const& element : node->getElements( ) )
-	{
-		tmp = first( element );
-		ret.insert( tmp.begin( ), tmp.end( ) );
+	for ( auto const & element : node->getElements ( ) ) {
+		tmp = first ( element );
+		ret.insert ( tmp.begin ( ), tmp.end ( ) );
 
-		if(! regexp::properties::RegExpEpsilon::languageContainsEpsilon(*element)) // If regexp of this subtree can match epsilon, then we need to add next subtree
+		if ( !regexp::properties::RegExpEpsilon::languageContainsEpsilon ( * element ) ) // If regexp of this subtree can match epsilon, then we need to add next subtree
 			break;
 	}
 
 	return ret;
 }
 
-std::set<regexp::UnboundedRegExpSymbol const *> GlushkovTraversal::first( regexp::UnboundedRegExpIteration const * const & node )
-{
-	return first( & node->getElement( ) );
+std::set < regexp::UnboundedRegExpSymbol const * > GlushkovTraversal::first ( regexp::UnboundedRegExpIteration const * const & node ) {
+	return first ( & node->getElement ( ) );
 }
 
-std::set<regexp::UnboundedRegExpSymbol const *> GlushkovTraversal::first( regexp::UnboundedRegExpSymbol const * const & node )
-{
-	return std::set<regexp::UnboundedRegExpSymbol const *> { node };
+std::set < regexp::UnboundedRegExpSymbol const * > GlushkovTraversal::first ( regexp::UnboundedRegExpSymbol const * const & node ) {
+	return std::set < regexp::UnboundedRegExpSymbol const * > { node };
 }
 
-std::set<regexp::UnboundedRegExpSymbol const *> GlushkovTraversal::first( regexp::UnboundedRegExpEpsilon const * const & /* node */ )
-{
-	return std::set<regexp::UnboundedRegExpSymbol const *>( );
+std::set < regexp::UnboundedRegExpSymbol const * > GlushkovTraversal::first ( regexp::UnboundedRegExpEpsilon const * const & /* node */ ) {
+	return std::set < regexp::UnboundedRegExpSymbol const * > ( );
 }
 
-std::set<regexp::UnboundedRegExpSymbol const *> GlushkovTraversal::first( regexp::UnboundedRegExpEmpty const * const &  /* node */ )
-{
-	return std::set<regexp::UnboundedRegExpSymbol const *>( );
+std::set < regexp::UnboundedRegExpSymbol const * > GlushkovTraversal::first ( regexp::UnboundedRegExpEmpty const * const & /* node */ ) {
+	return std::set < regexp::UnboundedRegExpSymbol const * > ( );
 }
 
 // ----------------------------------------------------------------------------
 
-std::set<regexp::UnboundedRegExpSymbol const *> GlushkovTraversal::last( regexp::UnboundedRegExpElement const * const & node )
-{
-	regexp::UnboundedRegExpAlternation const * const alternation = dynamic_cast<regexp::UnboundedRegExpAlternation const * const>( node );
-	regexp::UnboundedRegExpConcatenation const * const concatenation = dynamic_cast<regexp::UnboundedRegExpConcatenation const * const>( node );
-	regexp::UnboundedRegExpIteration const * const iteration = dynamic_cast<regexp::UnboundedRegExpIteration const * const>( node );
-	regexp::UnboundedRegExpSymbol const * const symbol = dynamic_cast<regexp::UnboundedRegExpSymbol const * const>( node );
-	regexp::UnboundedRegExpEmpty const * const empty = dynamic_cast<regexp::UnboundedRegExpEmpty const * const>( node );
-	regexp::UnboundedRegExpEpsilon const * const eps = dynamic_cast<regexp::UnboundedRegExpEpsilon const * const>( node );
-
-	if( symbol )
-		return last( symbol );
-	else if( alternation )
-		return last( alternation );
-	else if( concatenation )
-		return last( concatenation );
-	else if( iteration )
-		return last( iteration );
-	else if( eps )
-		return last( eps );
-	else if( empty )
-		return last( empty );
-
-	 throw exception::AlibException( "GlushkovTraversal::last - invalid RegExpElement node" );
-}
-
-std::set<regexp::UnboundedRegExpSymbol const *> GlushkovTraversal::last( regexp::UnboundedRegExpAlternation const * const & node )
-{
-	std::set<regexp::UnboundedRegExpSymbol const *> ret;
-
-	for( auto const& element : node->getElements( ) )
-	{
-		std::set<regexp::UnboundedRegExpSymbol const *> tmp = last( element );
-		ret.insert( tmp.begin( ), tmp.end( ) );
+std::set < regexp::UnboundedRegExpSymbol const * > GlushkovTraversal::last ( regexp::UnboundedRegExpElement const * const & node ) {
+	regexp::UnboundedRegExpAlternation const * const alternation = dynamic_cast < regexp::UnboundedRegExpAlternation const * const > ( node );
+	regexp::UnboundedRegExpConcatenation const * const concatenation = dynamic_cast < regexp::UnboundedRegExpConcatenation const * const > ( node );
+	regexp::UnboundedRegExpIteration const * const iteration = dynamic_cast < regexp::UnboundedRegExpIteration const * const > ( node );
+	regexp::UnboundedRegExpSymbol const * const symbol = dynamic_cast < regexp::UnboundedRegExpSymbol const * const > ( node );
+	regexp::UnboundedRegExpEmpty const * const empty = dynamic_cast < regexp::UnboundedRegExpEmpty const * const > ( node );
+	regexp::UnboundedRegExpEpsilon const * const eps = dynamic_cast < regexp::UnboundedRegExpEpsilon const * const > ( node );
+
+	if ( symbol )
+		return last ( symbol );
+	else if ( alternation )
+		return last ( alternation );
+	else if ( concatenation )
+		return last ( concatenation );
+	else if ( iteration )
+		return last ( iteration );
+	else if ( eps )
+		return last ( eps );
+	else if ( empty )
+		return last ( empty );
+
+	throw exception::AlibException ( "GlushkovTraversal::last - invalid RegExpElement node" );
+}
+
+std::set < regexp::UnboundedRegExpSymbol const * > GlushkovTraversal::last ( regexp::UnboundedRegExpAlternation const * const & node ) {
+	std::set < regexp::UnboundedRegExpSymbol const * > ret;
+
+	for ( auto const & element : node->getElements ( ) ) {
+		std::set < regexp::UnboundedRegExpSymbol const * > tmp = last ( element );
+		ret.insert ( tmp.begin ( ), tmp.end ( ) );
 	}
 
 	return ret;
 }
 
-std::set<regexp::UnboundedRegExpSymbol const *> GlushkovTraversal::last( regexp::UnboundedRegExpConcatenation const * const & node )
-{
-	std::set<regexp::UnboundedRegExpSymbol const *> ret, tmp;
+std::set < regexp::UnboundedRegExpSymbol const * > GlushkovTraversal::last ( regexp::UnboundedRegExpConcatenation const * const & node ) {
+	std::set < regexp::UnboundedRegExpSymbol const * > ret, tmp;
 
-	for( auto it = node->getElements( ).rbegin( ); it != node->getElements( ).rend( ) ; it ++ )
-	{
-		tmp = last( *it );
-		ret.insert( tmp.begin( ), tmp.end( ) );
+	for ( auto it = node->getElements ( ).rbegin ( ); it != node->getElements ( ).rend ( ); it++ ) {
+		tmp = last ( * it );
+		ret.insert ( tmp.begin ( ), tmp.end ( ) );
 
-		if( ! regexp::properties::RegExpEpsilon::languageContainsEpsilon(**it) )
+		if ( !regexp::properties::RegExpEpsilon::languageContainsEpsilon ( * * it ) )
 			break;
 	}
 
 	return ret;
 }
 
-std::set<regexp::UnboundedRegExpSymbol const *> GlushkovTraversal::last( regexp::UnboundedRegExpIteration const * const & node )
-{
-	return last( & node->getElement( ) );
+std::set < regexp::UnboundedRegExpSymbol const * > GlushkovTraversal::last ( regexp::UnboundedRegExpIteration const * const & node ) {
+	return last ( & node->getElement ( ) );
 }
 
-std::set<regexp::UnboundedRegExpSymbol const *> GlushkovTraversal::last( regexp::UnboundedRegExpSymbol const * const & node )
-{
-	return std::set<regexp::UnboundedRegExpSymbol const *> { node };
+std::set < regexp::UnboundedRegExpSymbol const * > GlushkovTraversal::last ( regexp::UnboundedRegExpSymbol const * const & node ) {
+	return std::set < regexp::UnboundedRegExpSymbol const * > { node };
 }
 
-std::set<regexp::UnboundedRegExpSymbol const *> GlushkovTraversal::last( regexp::UnboundedRegExpEpsilon const * const & /* node */ )
-{
-	return std::set<regexp::UnboundedRegExpSymbol const *>( );
+std::set < regexp::UnboundedRegExpSymbol const * > GlushkovTraversal::last ( regexp::UnboundedRegExpEpsilon const * const & /* node */ ) {
+	return std::set < regexp::UnboundedRegExpSymbol const * > ( );
 }
 
-std::set<regexp::UnboundedRegExpSymbol const *> GlushkovTraversal::last( regexp::UnboundedRegExpEmpty const * const & /* node */ )
-{
-	return std::set<regexp::UnboundedRegExpSymbol const *>( );
+std::set < regexp::UnboundedRegExpSymbol const * > GlushkovTraversal::last ( regexp::UnboundedRegExpEmpty const * const & /* node */ ) {
+	return std::set < regexp::UnboundedRegExpSymbol const * > ( );
 }
 
 // ----------------------------------------------------------------------------
 
-std::set<regexp::UnboundedRegExpSymbol const *> GlushkovTraversal::follow( regexp::UnboundedRegExpElement const * const & node, regexp::UnboundedRegExpSymbol const * const & symbolptr )
-{
-	regexp::UnboundedRegExpAlternation const * const alternation = dynamic_cast<regexp::UnboundedRegExpAlternation const * const>( node );
-	regexp::UnboundedRegExpConcatenation const * const concatenation = dynamic_cast<regexp::UnboundedRegExpConcatenation const * const>( node );
-	regexp::UnboundedRegExpIteration const * const iteration = dynamic_cast<regexp::UnboundedRegExpIteration const * const>( node );
-	regexp::UnboundedRegExpSymbol const * const symbol = dynamic_cast<regexp::UnboundedRegExpSymbol const * const>( node );
-	regexp::UnboundedRegExpEmpty const * const empty = dynamic_cast<regexp::UnboundedRegExpEmpty const * const>( node );
-	regexp::UnboundedRegExpEpsilon const * const eps = dynamic_cast<regexp::UnboundedRegExpEpsilon const * const>( node );
+std::set < regexp::UnboundedRegExpSymbol const * > GlushkovTraversal::follow ( regexp::UnboundedRegExpElement const * const & node, regexp::UnboundedRegExpSymbol const * const & symbolptr ) {
+	regexp::UnboundedRegExpAlternation const * const alternation = dynamic_cast < regexp::UnboundedRegExpAlternation const * const > ( node );
+	regexp::UnboundedRegExpConcatenation const * const concatenation = dynamic_cast < regexp::UnboundedRegExpConcatenation const * const > ( node );
+	regexp::UnboundedRegExpIteration const * const iteration = dynamic_cast < regexp::UnboundedRegExpIteration const * const > ( node );
+	regexp::UnboundedRegExpSymbol const * const symbol = dynamic_cast < regexp::UnboundedRegExpSymbol const * const > ( node );
+	regexp::UnboundedRegExpEmpty const * const empty = dynamic_cast < regexp::UnboundedRegExpEmpty const * const > ( node );
+	regexp::UnboundedRegExpEpsilon const * const eps = dynamic_cast < regexp::UnboundedRegExpEpsilon const * const > ( node );
 
-	if( alternation )
-		return follow( alternation, symbolptr );
+	if ( alternation )
+		return follow ( alternation, symbolptr );
 
-	else if( concatenation )
-		return follow( concatenation, symbolptr );
+	else if ( concatenation )
+		return follow ( concatenation, symbolptr );
 
-	else if( iteration )
-		return follow( iteration, symbolptr );
+	else if ( iteration )
+		return follow ( iteration, symbolptr );
 
-	else if( symbol )
-		return follow( symbol, symbolptr );
+	else if ( symbol )
+		return follow ( symbol, symbolptr );
 
-	else if( empty )
-		return follow( empty, symbolptr );
+	else if ( empty )
+		return follow ( empty, symbolptr );
 
-	else if( eps )
-		return follow( eps, symbolptr );
+	else if ( eps )
+		return follow ( eps, symbolptr );
 
-	throw exception::AlibException( "GlushkovTraversal::follow() - unknown RegExpElement node" );
+	throw exception::AlibException ( "GlushkovTraversal::follow() - unknown RegExpElement node" );
 }
 
-std::set<regexp::UnboundedRegExpSymbol const *> GlushkovTraversal::follow( regexp::UnboundedRegExpAlternation const * const & node, regexp::UnboundedRegExpSymbol const * const & symbolptr )
-{
-	for( auto const& element : node->getElements( ) )
-		if( pos( element, symbolptr ) )
-			return follow( element, symbolptr );
+std::set < regexp::UnboundedRegExpSymbol const * > GlushkovTraversal::follow ( regexp::UnboundedRegExpAlternation const * const & node, regexp::UnboundedRegExpSymbol const * const & symbolptr ) {
+	for ( auto const & element : node->getElements ( ) )
+		if ( pos ( element, symbolptr ) )
+			return follow ( element, symbolptr );
 
-	throw exception::AlibException( "GlushkovTraversal::follow(Alt)" );
+	throw exception::AlibException ( "GlushkovTraversal::follow(Alt)" );
 }
 
-std::set<regexp::UnboundedRegExpSymbol const *> GlushkovTraversal::follow( regexp::UnboundedRegExpConcatenation const * const & node, regexp::UnboundedRegExpSymbol const * const & symbolptr )
-{
-	std::set<regexp::UnboundedRegExpSymbol const *> ret, tmp, lastSet;
+std::set < regexp::UnboundedRegExpSymbol const * > GlushkovTraversal::follow ( regexp::UnboundedRegExpConcatenation const * const & node, regexp::UnboundedRegExpSymbol const * const & symbolptr ) {
+	std::set < regexp::UnboundedRegExpSymbol const * > ret, tmp, lastSet;
 
-	for( auto e = node->getElements( ).begin( ); e != node->getElements( ).end( ); e ++ )
-	{
-		if( ! pos( *e, symbolptr ) )
+	for ( auto e = node->getElements ( ).begin ( ); e != node->getElements ( ).end ( ); e++ ) {
+		if ( !pos ( * e, symbolptr ) )
 			continue;
 
-		tmp = follow( *e, symbolptr );
-		ret.insert( tmp.begin( ), tmp.end( ) );
+		tmp = follow ( * e, symbolptr );
+		ret.insert ( tmp.begin ( ), tmp.end ( ) );
 
-		lastSet = last( *e );
-		if( isInSet( symbolptr, lastSet ) )
-		{
-			for( auto f = next( e ); f != node->getElements( ).end( ); f ++ )
-			{
-				tmp = first( *f );
-				ret.insert( tmp.begin( ), tmp.end( ) );
+		lastSet = last ( * e );
 
-				if( ! regexp::properties::RegExpEpsilon::languageContainsEpsilon( **f ) )
+		if ( lastSet.find ( symbolptr ) != lastSet.end ( ) )
+			for ( auto f = next ( e ); f != node->getElements ( ).end ( ); f++ ) {
+				tmp = first ( * f );
+				ret.insert ( tmp.begin ( ), tmp.end ( ) );
+
+				if ( !regexp::properties::RegExpEpsilon::languageContainsEpsilon ( * * f ) )
 					break;
 			}
-		}
+
 	}
+
 	return ret;
 }
 
-std::set<regexp::UnboundedRegExpSymbol const *> GlushkovTraversal::follow( regexp::UnboundedRegExpIteration const * const & node, regexp::UnboundedRegExpSymbol const * const & symbolptr )
-{
-	std::set<regexp::UnboundedRegExpSymbol const *> ret = follow( & node->getElement( ), symbolptr );
-	std::set<regexp::UnboundedRegExpSymbol const *> lastSet = last( & node->getElement( ) );
+std::set < regexp::UnboundedRegExpSymbol const * > GlushkovTraversal::follow ( regexp::UnboundedRegExpIteration const * const & node, regexp::UnboundedRegExpSymbol const * const & symbolptr ) {
+	std::set < regexp::UnboundedRegExpSymbol const * > ret = follow ( & node->getElement ( ), symbolptr );
+	std::set < regexp::UnboundedRegExpSymbol const * > lastSet = last ( & node->getElement ( ) );
 
-	if( isInSet( symbolptr, lastSet ) )
-	{
-		std::set<regexp::UnboundedRegExpSymbol const *> firstSet = first( & node->getElement( ) );
-		ret.insert( firstSet.begin( ), firstSet.end( ) );
+	if ( lastSet.find ( symbolptr ) != lastSet.end ( ) ) {
+		std::set < regexp::UnboundedRegExpSymbol const * > firstSet = first ( & node->getElement ( ) );
+		ret.insert ( firstSet.begin ( ), firstSet.end ( ) );
 	}
 
 	return ret;
 }
 
-std::set<regexp::UnboundedRegExpSymbol const *> GlushkovTraversal::follow( regexp::UnboundedRegExpSymbol const * const & /* node */, regexp::UnboundedRegExpSymbol const * const & /* symbolptr */ )
-{
-	return std::set<regexp::UnboundedRegExpSymbol const *>( );
+std::set < regexp::UnboundedRegExpSymbol const * > GlushkovTraversal::follow ( regexp::UnboundedRegExpSymbol const * const & /* node */, regexp::UnboundedRegExpSymbol const * const & /* symbolptr */ ) {
+	return std::set < regexp::UnboundedRegExpSymbol const * > ( );
 }
 
-std::set<regexp::UnboundedRegExpSymbol const *> GlushkovTraversal::follow( regexp::UnboundedRegExpEmpty const * const & /* node */, regexp::UnboundedRegExpSymbol const * const & /* symbolptr */ )
-{
-	return std::set<regexp::UnboundedRegExpSymbol const *>( );
+std::set < regexp::UnboundedRegExpSymbol const * > GlushkovTraversal::follow ( regexp::UnboundedRegExpEmpty const * const & /* node */, regexp::UnboundedRegExpSymbol const * const & /* symbolptr */ ) {
+	return std::set < regexp::UnboundedRegExpSymbol const * > ( );
 }
 
-std::set<regexp::UnboundedRegExpSymbol const *> GlushkovTraversal::follow( regexp::UnboundedRegExpEpsilon const * const & /* node */, regexp::UnboundedRegExpSymbol const * const & /* symbolptr */ )
-{
-	return std::set<regexp::UnboundedRegExpSymbol const *>( );
+std::set < regexp::UnboundedRegExpSymbol const * > GlushkovTraversal::follow ( regexp::UnboundedRegExpEpsilon const * const & /* node */, regexp::UnboundedRegExpSymbol const * const & /* symbolptr */ ) {
+	return std::set < regexp::UnboundedRegExpSymbol const * > ( );
 }
 
 // ----------------------------------------------------------------------------
 
-bool GlushkovTraversal::pos( regexp::UnboundedRegExpElement const * const & node, regexp::UnboundedRegExpSymbol const * const & symbolptr )
-{
-	regexp::UnboundedRegExpAlternation const * const alternation = dynamic_cast<regexp::UnboundedRegExpAlternation const * const>( node );
-	regexp::UnboundedRegExpConcatenation const * const concatenation = dynamic_cast<regexp::UnboundedRegExpConcatenation const * const>( node );
-	regexp::UnboundedRegExpIteration const * const iteration = dynamic_cast<regexp::UnboundedRegExpIteration const * const>( node );
-	regexp::UnboundedRegExpSymbol const * const symbol = dynamic_cast<regexp::UnboundedRegExpSymbol const * const>( node );
-	regexp::UnboundedRegExpEmpty const * const empty = dynamic_cast<regexp::UnboundedRegExpEmpty const * const>( node );
-	regexp::UnboundedRegExpEpsilon const * const eps = dynamic_cast<regexp::UnboundedRegExpEpsilon const * const>( node );
+bool GlushkovTraversal::pos ( regexp::UnboundedRegExpElement const * const & node, regexp::UnboundedRegExpSymbol const * const & symbolptr ) {
+	regexp::UnboundedRegExpAlternation const * const alternation = dynamic_cast < regexp::UnboundedRegExpAlternation const * const > ( node );
+	regexp::UnboundedRegExpConcatenation const * const concatenation = dynamic_cast < regexp::UnboundedRegExpConcatenation const * const > ( node );
+	regexp::UnboundedRegExpIteration const * const iteration = dynamic_cast < regexp::UnboundedRegExpIteration const * const > ( node );
+	regexp::UnboundedRegExpSymbol const * const symbol = dynamic_cast < regexp::UnboundedRegExpSymbol const * const > ( node );
+	regexp::UnboundedRegExpEmpty const * const empty = dynamic_cast < regexp::UnboundedRegExpEmpty const * const > ( node );
+	regexp::UnboundedRegExpEpsilon const * const eps = dynamic_cast < regexp::UnboundedRegExpEpsilon const * const > ( node );
 
-	if( alternation )
-		return pos( alternation, symbolptr );
+	if ( alternation )
+		return pos ( alternation, symbolptr );
 
-	else if( concatenation )
-		return pos( concatenation, symbolptr );
+	else if ( concatenation )
+		return pos ( concatenation, symbolptr );
 
-	else if( iteration )
-		return pos( iteration, symbolptr );
+	else if ( iteration )
+		return pos ( iteration, symbolptr );
 
-	else if( symbol )
-		return pos( symbol, symbolptr );
+	else if ( symbol )
+		return pos ( symbol, symbolptr );
 
-	else if( empty )
-		return pos( empty, symbolptr );
+	else if ( empty )
+		return pos ( empty, symbolptr );
 
-	else if( eps )
-		return pos( eps, symbolptr );
+	else if ( eps )
+		return pos ( eps, symbolptr );
 
-	throw exception::AlibException( "GlushkovTraversal::pos() - unknown RegExpElement node" );
+	throw exception::AlibException ( "GlushkovTraversal::pos() - unknown RegExpElement node" );
 }
 
-bool GlushkovTraversal::pos( regexp::UnboundedRegExpAlternation const * const & node, regexp::UnboundedRegExpSymbol const * const & symbolptr )
-{
-	for( auto const& element : node->getElements( ) )
-		if( pos( element, symbolptr ) )
+bool GlushkovTraversal::pos ( regexp::UnboundedRegExpAlternation const * const & node, regexp::UnboundedRegExpSymbol const * const & symbolptr ) {
+	for ( auto const & element : node->getElements ( ) )
+		if ( pos ( element, symbolptr ) )
 			return true;
+
 	return false;
 }
 
-bool GlushkovTraversal::pos( regexp::UnboundedRegExpConcatenation const * const & node, regexp::UnboundedRegExpSymbol const * const & symbolptr )
-{
-	for( auto const& element : node->getElements( ) )
-		if( pos( element, symbolptr ) )
+bool GlushkovTraversal::pos ( regexp::UnboundedRegExpConcatenation const * const & node, regexp::UnboundedRegExpSymbol const * const & symbolptr ) {
+	for ( auto const & element : node->getElements ( ) )
+		if ( pos ( element, symbolptr ) )
 			return true;
+
 	return false;
 }
 
-bool GlushkovTraversal::pos( regexp::UnboundedRegExpIteration const * const & node, regexp::UnboundedRegExpSymbol const * const & symbolptr )
-{
-	return pos( & node->getElement( ), symbolptr );
+bool GlushkovTraversal::pos ( regexp::UnboundedRegExpIteration const * const & node, regexp::UnboundedRegExpSymbol const * const & symbolptr ) {
+	return pos ( & node->getElement ( ), symbolptr );
 }
 
-bool GlushkovTraversal::pos( regexp::UnboundedRegExpSymbol const * const & node, regexp::UnboundedRegExpSymbol const * const & symbolptr )
-{
+bool GlushkovTraversal::pos ( regexp::UnboundedRegExpSymbol const * const & node, regexp::UnboundedRegExpSymbol const * const & symbolptr ) {
 	return symbolptr == node;
 }
 
-bool GlushkovTraversal::pos( regexp::UnboundedRegExpEmpty const * const & /* node */, regexp::UnboundedRegExpSymbol const * const & /* symbolptr */ )
-{
+bool GlushkovTraversal::pos ( regexp::UnboundedRegExpEmpty const * const & /* node */, regexp::UnboundedRegExpSymbol const * const & /* symbolptr */ ) {
 	return false;
 }
 
-bool GlushkovTraversal::pos( regexp::UnboundedRegExpEpsilon const * const & /* node */, regexp::UnboundedRegExpSymbol const * const & /* symbolptr */ )
-{
+bool GlushkovTraversal::pos ( regexp::UnboundedRegExpEpsilon const * const & /* node */, regexp::UnboundedRegExpSymbol const * const & /* symbolptr */ ) {
 	return false;
 }
 
 // ----------------------------------------------------------------------------
 
-std::set<GlushkovSymbol> GlushkovTraversal::getSymbols( regexp::UnboundedRegExp const& re )
-{
-	std::set<GlushkovSymbol> alphabet;
+std::set < GlushkovSymbol > GlushkovTraversal::getSymbols ( regexp::UnboundedRegExp const & re ) {
+	std::set < GlushkovSymbol > alphabet;
 	int i = 1;
 
-	getSymbols( & re.getRegExp( ), alphabet, i );
+	getSymbols ( & re.getRegExp ( ), alphabet, i );
 
 	return alphabet;
 }
 
-void GlushkovTraversal::getSymbols( regexp::UnboundedRegExpElement const * const & node, std::set<GlushkovSymbol> & alphabet, int & i )
-{
-	regexp::UnboundedRegExpAlternation const * const alternation = dynamic_cast<regexp::UnboundedRegExpAlternation const * const>( node );
-	regexp::UnboundedRegExpConcatenation const * const concatenation = dynamic_cast<regexp::UnboundedRegExpConcatenation const * const>( node );
-	regexp::UnboundedRegExpIteration const * const iteration = dynamic_cast<regexp::UnboundedRegExpIteration const * const>( node );
-	regexp::UnboundedRegExpSymbol const * const symbol = dynamic_cast<regexp::UnboundedRegExpSymbol const * const>( node );
-	regexp::UnboundedRegExpEmpty const * const empty = dynamic_cast<regexp::UnboundedRegExpEmpty const * const>( node );
-	regexp::UnboundedRegExpEpsilon const * const eps = dynamic_cast<regexp::UnboundedRegExpEpsilon const * const>( node );
+void GlushkovTraversal::getSymbols ( regexp::UnboundedRegExpElement const * const & node, std::set < GlushkovSymbol > & alphabet, int & i ) {
+	regexp::UnboundedRegExpAlternation const * const alternation = dynamic_cast < regexp::UnboundedRegExpAlternation const * const > ( node );
+	regexp::UnboundedRegExpConcatenation const * const concatenation = dynamic_cast < regexp::UnboundedRegExpConcatenation const * const > ( node );
+	regexp::UnboundedRegExpIteration const * const iteration = dynamic_cast < regexp::UnboundedRegExpIteration const * const > ( node );
+	regexp::UnboundedRegExpSymbol const * const symbol = dynamic_cast < regexp::UnboundedRegExpSymbol const * const > ( node );
+	regexp::UnboundedRegExpEmpty const * const empty = dynamic_cast < regexp::UnboundedRegExpEmpty const * const > ( node );
+	regexp::UnboundedRegExpEpsilon const * const eps = dynamic_cast < regexp::UnboundedRegExpEpsilon const * const > ( node );
 
-	if( symbol )
-	{
-		alphabet.insert( GlushkovSymbol( symbol, i ++ ) );
+	if ( symbol ) {
+		alphabet.insert ( GlushkovSymbol ( symbol, i++ ) );
 		return;
-	}
+	} else if ( alternation ) {
+		for ( const auto & element : alternation->getElements ( ) )
+			getSymbols ( element, alphabet, i );
 
-	else if( alternation )
-	{
-		for( const auto & element : alternation->getElements( ) )
-			getSymbols( element, alphabet, i );
 		return;
-	}
+	} else if ( concatenation ) {
+		for ( const auto & element : concatenation->getElements ( ) )
+			getSymbols ( element, alphabet, i );
 
-	else if( concatenation )
-	{
-		for( const auto & element : concatenation->getElements( ) )
-			getSymbols( element, alphabet, i );
 		return;
-	}
-
-	else if( iteration )
-	{
-		getSymbols( & iteration->getElement( ), alphabet, i );
+	} else if ( iteration ) {
+		getSymbols ( & iteration->getElement ( ), alphabet, i );
 		return;
-	}
-
-	else if( empty )
+	} else if ( empty ) {
 		return;
-
-	else if( eps )
+	} else if ( eps ) {
 		return;
+	}
 
-	throw exception::AlibException( "GlushkovTraversal::getSymbols() - unknown RegExpElement node" );
+	throw exception::AlibException ( "GlushkovTraversal::getSymbols() - unknown RegExpElement node" );
 }
 
 } /* namespace conversions */
diff --git a/alib2algo/src/regexp/GlushkovTraversal.h b/alib2algo/src/regexp/GlushkovTraversal.h
index 8f47d231c1a7f9fe465d2f477b13e241491d9aff..4ddc81df9f240ee467fdea6cdb0d37c2317124b1 100644
--- a/alib2algo/src/regexp/GlushkovTraversal.h
+++ b/alib2algo/src/regexp/GlushkovTraversal.h
@@ -25,43 +25,40 @@
 
 #include "GlushkovSymbol.h"
 #include "GlushkovPair.h"
-#include "aux/macros.h"
 
-namespace regexp
-{
+namespace regexp {
 
 /**
  * RegExp tree traversal utils for Glushkov algorithm.
  *
  * Thanks to http://www.sciencedirect.com/science/article/pii/S030439759700296X for better follow() solution.
  */
-class GlushkovTraversal
-{
+class GlushkovTraversal {
 public:
 	/**
 	 * @param re RegExp to probe
 	 * @return all RegExpSymbols whichcan start the word.
 	 */
-	static std::set<GlushkovSymbol> first( regexp::UnboundedRegExp const& re );
+	static std::set < GlushkovSymbol > first ( regexp::UnboundedRegExp const & re );
 
 	/**
 	 * @param re RegExp to probe
 	 * @return all RegExpSymbols that can terminate the word.
 	 */
-	static std::set<GlushkovSymbol> last( regexp::UnboundedRegExp const& re );
+	static std::set < GlushkovSymbol > last ( regexp::UnboundedRegExp const & re );
 
 	/**
 	 * @param re RegExp to probe
 	 * @param symbol GlushkovSymbol for which we need the follow()
 	 * @return all symbols that can follow specific symbol in word
 	 */
-	static std::set<GlushkovSymbol> follow( regexp::UnboundedRegExp const& re, GlushkovSymbol const& symbol );
+	static std::set < GlushkovSymbol > follow ( regexp::UnboundedRegExp const & re, GlushkovSymbol const & symbol );
 
 	/**
 	 * @param re RegExp to probe
 	 * @return symbols of regexp tree in order of they occurence in regexp.
 	 */
-	static std::set<GlushkovSymbol> getSymbols( regexp::UnboundedRegExp const& re );
+	static std::set < GlushkovSymbol > getSymbols ( regexp::UnboundedRegExp const & re );
 
 private:
 	/**
@@ -69,46 +66,46 @@ private:
 	 * @param symbolSet set of gl.symbols
 	 * @return GlushkovSymbol equivalent for RegExpSymbol pointer
 	 */
-	static GlushkovSymbol const& findSymbol( regexp::UnboundedRegExpSymbol const * const symbol, const std::set<GlushkovSymbol> & symbolSet );
+	static GlushkovSymbol const & findSymbol ( regexp::UnboundedRegExpSymbol const * const symbol, const std::set < GlushkovSymbol > & symbolSet );
 
 	/**
 	 * @return bool true if symbol pointer is in this subtree
 	 */
-	static bool pos( GlushkovSymbol const & symbol, regexp::UnboundedRegExp const * const & node );
-
-	static void getSymbols( regexp::UnboundedRegExpElement const * const & node, std::set<GlushkovSymbol> & alphabet, int & i );
-
-	static std::set<regexp::UnboundedRegExpSymbol const *> first( regexp::UnboundedRegExpElement const * const & node );
-	static std::set<regexp::UnboundedRegExpSymbol const *> first( regexp::UnboundedRegExpAlternation const * const & node );
-	static std::set<regexp::UnboundedRegExpSymbol const *> first( regexp::UnboundedRegExpConcatenation const * const & node );
-	static std::set<regexp::UnboundedRegExpSymbol const *> first( regexp::UnboundedRegExpIteration const * const & node );
-	static std::set<regexp::UnboundedRegExpSymbol const *> first( regexp::UnboundedRegExpSymbol const * const & node );
-	static std::set<regexp::UnboundedRegExpSymbol const *> first( regexp::UnboundedRegExpEmpty const * const & node );
-	static std::set<regexp::UnboundedRegExpSymbol const *> first( regexp::UnboundedRegExpEpsilon const * const & node );
-
-	static std::set<regexp::UnboundedRegExpSymbol const *> last( regexp::UnboundedRegExpElement const * const & node );
-	static std::set<regexp::UnboundedRegExpSymbol const *> last( regexp::UnboundedRegExpAlternation const * const & node );
-	static std::set<regexp::UnboundedRegExpSymbol const *> last( regexp::UnboundedRegExpConcatenation const * const & node );
-	static std::set<regexp::UnboundedRegExpSymbol const *> last( regexp::UnboundedRegExpIteration const * const & node );
-	static std::set<regexp::UnboundedRegExpSymbol const *> last( regexp::UnboundedRegExpSymbol const * const & node );
-	static std::set<regexp::UnboundedRegExpSymbol const *> last( regexp::UnboundedRegExpEmpty const * const & node );
-	static std::set<regexp::UnboundedRegExpSymbol const *> last( regexp::UnboundedRegExpEpsilon const * const & node );
-
-	static bool pos( regexp::UnboundedRegExpElement const * const & node, regexp::UnboundedRegExpSymbol const * const & symbSearch );
-	static bool pos( regexp::UnboundedRegExpAlternation const * const & node, regexp::UnboundedRegExpSymbol const * const & symbSearch );
-	static bool pos( regexp::UnboundedRegExpConcatenation const * const & node, regexp::UnboundedRegExpSymbol const * const & symbSearch );
-	static bool pos( regexp::UnboundedRegExpIteration const * const & node, regexp::UnboundedRegExpSymbol const * const & symbSearch );
-	static bool pos( regexp::UnboundedRegExpSymbol const * const & node, regexp::UnboundedRegExpSymbol const * const & symbSearch );
-	static bool pos( regexp::UnboundedRegExpEmpty const * const & node, regexp::UnboundedRegExpSymbol const * const & symbSearch );
-	static bool pos( regexp::UnboundedRegExpEpsilon const * const & node, regexp::UnboundedRegExpSymbol const * const & symbSearch );
-
-	static std::set<regexp::UnboundedRegExpSymbol const *> follow( regexp::UnboundedRegExpElement const * const & node, regexp::UnboundedRegExpSymbol const * const & symbFollow );
-	static std::set<regexp::UnboundedRegExpSymbol const *> follow( regexp::UnboundedRegExpAlternation const * const & node, regexp::UnboundedRegExpSymbol const * const & symbFollow );
-	static std::set<regexp::UnboundedRegExpSymbol const *> follow( regexp::UnboundedRegExpConcatenation const * const & node, regexp::UnboundedRegExpSymbol const * const & symbFollow );
-	static std::set<regexp::UnboundedRegExpSymbol const *> follow( regexp::UnboundedRegExpIteration const * const & node, regexp::UnboundedRegExpSymbol const * const & symbFollow );
-	static std::set<regexp::UnboundedRegExpSymbol const *> follow( regexp::UnboundedRegExpSymbol const * const & node, regexp::UnboundedRegExpSymbol const * const & symbFollow );
-	static std::set<regexp::UnboundedRegExpSymbol const *> follow( regexp::UnboundedRegExpEmpty const * const & node, regexp::UnboundedRegExpSymbol const * const & symbFollow );
-	static std::set<regexp::UnboundedRegExpSymbol const *> follow( regexp::UnboundedRegExpEpsilon const * const & node, regexp::UnboundedRegExpSymbol const * const & symbFollow );
+	static bool pos ( GlushkovSymbol const & symbol, regexp::UnboundedRegExp const * const & node );
+
+	static void getSymbols ( regexp::UnboundedRegExpElement const * const & node, std::set < GlushkovSymbol > & alphabet, int & i );
+
+	static std::set < regexp::UnboundedRegExpSymbol const * > first ( regexp::UnboundedRegExpElement const * const & node );
+	static std::set < regexp::UnboundedRegExpSymbol const * > first ( regexp::UnboundedRegExpAlternation const * const & node );
+	static std::set < regexp::UnboundedRegExpSymbol const * > first ( regexp::UnboundedRegExpConcatenation const * const & node );
+	static std::set < regexp::UnboundedRegExpSymbol const * > first ( regexp::UnboundedRegExpIteration const * const & node );
+	static std::set < regexp::UnboundedRegExpSymbol const * > first ( regexp::UnboundedRegExpSymbol const * const & node );
+	static std::set < regexp::UnboundedRegExpSymbol const * > first ( regexp::UnboundedRegExpEmpty const * const & node );
+	static std::set < regexp::UnboundedRegExpSymbol const * > first ( regexp::UnboundedRegExpEpsilon const * const & node );
+
+	static std::set < regexp::UnboundedRegExpSymbol const * > last ( regexp::UnboundedRegExpElement const * const & node );
+	static std::set < regexp::UnboundedRegExpSymbol const * > last ( regexp::UnboundedRegExpAlternation const * const & node );
+	static std::set < regexp::UnboundedRegExpSymbol const * > last ( regexp::UnboundedRegExpConcatenation const * const & node );
+	static std::set < regexp::UnboundedRegExpSymbol const * > last ( regexp::UnboundedRegExpIteration const * const & node );
+	static std::set < regexp::UnboundedRegExpSymbol const * > last ( regexp::UnboundedRegExpSymbol const * const & node );
+	static std::set < regexp::UnboundedRegExpSymbol const * > last ( regexp::UnboundedRegExpEmpty const * const & node );
+	static std::set < regexp::UnboundedRegExpSymbol const * > last ( regexp::UnboundedRegExpEpsilon const * const & node );
+
+	static bool pos ( regexp::UnboundedRegExpElement const * const & node, regexp::UnboundedRegExpSymbol const * const & symbSearch );
+	static bool pos ( regexp::UnboundedRegExpAlternation const * const & node, regexp::UnboundedRegExpSymbol const * const & symbSearch );
+	static bool pos ( regexp::UnboundedRegExpConcatenation const * const & node, regexp::UnboundedRegExpSymbol const * const & symbSearch );
+	static bool pos ( regexp::UnboundedRegExpIteration const * const & node, regexp::UnboundedRegExpSymbol const * const & symbSearch );
+	static bool pos ( regexp::UnboundedRegExpSymbol const * const & node, regexp::UnboundedRegExpSymbol const * const & symbSearch );
+	static bool pos ( regexp::UnboundedRegExpEmpty const * const & node, regexp::UnboundedRegExpSymbol const * const & symbSearch );
+	static bool pos ( regexp::UnboundedRegExpEpsilon const * const & node, regexp::UnboundedRegExpSymbol const * const & symbSearch );
+
+	static std::set < regexp::UnboundedRegExpSymbol const * > follow ( regexp::UnboundedRegExpElement const * const & node, regexp::UnboundedRegExpSymbol const * const & symbFollow );
+	static std::set < regexp::UnboundedRegExpSymbol const * > follow ( regexp::UnboundedRegExpAlternation const * const & node, regexp::UnboundedRegExpSymbol const * const & symbFollow );
+	static std::set < regexp::UnboundedRegExpSymbol const * > follow ( regexp::UnboundedRegExpConcatenation const * const & node, regexp::UnboundedRegExpSymbol const * const & symbFollow );
+	static std::set < regexp::UnboundedRegExpSymbol const * > follow ( regexp::UnboundedRegExpIteration const * const & node, regexp::UnboundedRegExpSymbol const * const & symbFollow );
+	static std::set < regexp::UnboundedRegExpSymbol const * > follow ( regexp::UnboundedRegExpSymbol const * const & node, regexp::UnboundedRegExpSymbol const * const & symbFollow );
+	static std::set < regexp::UnboundedRegExpSymbol const * > follow ( regexp::UnboundedRegExpEmpty const * const & node, regexp::UnboundedRegExpSymbol const * const & symbFollow );
+	static std::set < regexp::UnboundedRegExpSymbol const * > follow ( regexp::UnboundedRegExpEpsilon const * const & node, regexp::UnboundedRegExpSymbol const * const & symbFollow );
 };
 
 } /* namespace conversions */
diff --git a/alib2algo/src/regexp/generate/RandomRegExpFactory.cpp b/alib2algo/src/regexp/generate/RandomRegExpFactory.cpp
index 74655d82b13b8ad8cea5e2cade98805d621bd96b..9277b4b26f67d59285e2dfcae9382c5f441956dc 100644
--- a/alib2algo/src/regexp/generate/RandomRegExpFactory.cpp
+++ b/alib2algo/src/regexp/generate/RandomRegExpFactory.cpp
@@ -16,8 +16,6 @@ namespace regexp {
 namespace generate {
 
 regexp::UnboundedRegExp RandomRegExpFactory::generateUnboundedRegExp( size_t leafNodes, size_t height, size_t alphabetSize, bool randomizedAlphabet ) {
-	srand( time( NULL ) );
-
 	if(alphabetSize > 26)
 		throw exception::AlibException("Too big alphabet.");
 
diff --git a/alib2algo/src/string/generate/RandomStringFactory.cpp b/alib2algo/src/string/generate/RandomStringFactory.cpp
index a583050aa11abd8bc39caa071a85e8604bb61cd9..b09850e9746c9cd3fda43f7bbe614d35ad7f49ea 100644
--- a/alib2algo/src/string/generate/RandomStringFactory.cpp
+++ b/alib2algo/src/string/generate/RandomStringFactory.cpp
@@ -18,8 +18,6 @@ namespace string {
 namespace generate {
 
 string::LinearString RandomStringFactory::generateLinearString ( size_t size, size_t alphabetSize, bool randomizedAlphabet ) {
-	srand ( time ( NULL ) );
-
 	if ( alphabetSize > 26 )
 		throw exception::AlibException ( "Too big alphabet." );
 
diff --git a/alib2algo/src/string/generate/RandomSubstringFactory.cpp b/alib2algo/src/string/generate/RandomSubstringFactory.cpp
index 69964684be1c23cc78529211f1425aeb119109dc..270a1cf73356d8c52fed40ae38e10c1101852a38 100644
--- a/alib2algo/src/string/generate/RandomSubstringFactory.cpp
+++ b/alib2algo/src/string/generate/RandomSubstringFactory.cpp
@@ -25,8 +25,6 @@ string::LinearString RandomSubstringFactory::generateSubstring ( size_t size, co
 	if ( size > string.getContent ( ).size ( ) )
 		throw exception::AlibException ( "String not long enough" );
 
-	srand ( time ( NULL ) );
-
 	size_t begin = std::random_devices::semirandom ( ) % ( string.getContent ( ).size ( ) - size + 1 );
 
 	std::vector < alphabet::Symbol > data ( string.getContent ( ).begin ( ) + begin, string.getContent ( ).begin ( ) + begin + size );
diff --git a/alib2common/src/aux/macros.h b/alib2common/src/aux/macros.h
deleted file mode 100644
index 735e2299484b0c9ff8d72ec4e4910c95c740d83e..0000000000000000000000000000000000000000
--- a/alib2common/src/aux/macros.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef MACROS_H_
-#define MACROS_H_
-
-#include <algorithm>
-#include <set>
-#include <list>
-
-namespace conversions
-{
-
-#define isInSet(x,set) ( (set).find((x)) != (set).end() )
-#define isInList(x,list) ( find((list).begin(), (list).end(), (x)) != (list).end() )
-#define isKeyInMap(key,map) ( (map).find((key)) != (map).end() )
-
-} /* namespace conversions */
-
-#endif /* MACROS_H_ */
diff --git a/makefile b/makefile
index aa6c154097c1ceed86f22fbe4d4a7a158d88c818..6a4fa8d926b9d55177e2bf79b97440952d843a06 100644
--- a/makefile
+++ b/makefile
@@ -4,6 +4,13 @@ APPPATH = /usr/bin
 LIBPATH = /usr/lib
 BINFOLDER = bin
 
+MAKE_PID := $(shell echo $$PPID)
+JOB_FLAG := $(filter -j%, $(subst -j ,-j,$(shell ps T | grep "^\s*$(MAKE_PID).*$(MAKE)")))
+JOBS     := $(subst -j,,$(JOB_FLAG))
+ifndef JOBS
+JOBS := 1
+endif
+
 STD_LIB = alib2std
 DATA_LIB = alib2data
 COMMON_LIB = alib2common
@@ -108,13 +115,13 @@ debug: all-debug
 	for dir in $(SUBDIRS_BINS); do \
 	    cp $$dir/bin-debug/* $(addsuffix -debug, $(BINFOLDER)); \
 	done
-	./tests.examples.sh debug
-	./tests.adeterminize.sh debug
-	./tests.aconversion.sh debug
-	./tests.aderivation.aintegral.sh debug
-	./tests.astringology.sh debug
-	./tests.anormalize.sh debug
-	./tests.aarbology.sh debug
+	./tests.examples.sh debug $(JOBS)
+	./tests.adeterminize.sh debug $(JOBS)
+	./tests.aconversion.sh debug $(JOBS)
+	./tests.aderivation.aintegral.sh debug $(JOBS)
+	./tests.astringology.sh debug $(JOBS)
+	./tests.anormalize.sh debug $(JOBS)
+	./tests.aarbology.sh debug $(JOBS)
 
 release: all-release
 	if [ ! -w $(addsuffix -release, $(BINFOLDER)) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
@@ -132,13 +139,13 @@ release: all-release
 	for dir in $(SUBDIRS_BINS); do \
 	    cp $$dir/bin-release/* $(addsuffix -release, $(BINFOLDER)); \
 	done
-	./tests.examples.sh release
-	./tests.adeterminize.sh release
-	./tests.aconversion.sh release
-	./tests.aderivation.aintegral.sh release
-	./tests.astringology.sh release
-	./tests.anormalize.sh release
-	./tests.aarbology.sh release
+	./tests.examples.sh release $(JOBS)
+	./tests.adeterminize.sh release $(JOBS)
+	./tests.aconversion.sh release $(JOBS)
+	./tests.aderivation.aintegral.sh release $(JOBS)
+	./tests.astringology.sh release $(JOBS)
+	./tests.anormalize.sh release $(JOBS)
+	./tests.aarbology.sh release $(JOBS)
 
 clean  : clean-debug   clean-release
 	$(RM) -r bin-debug bin-release
diff --git a/tests.aarbology.sh b/tests.aarbology.sh
index 792efe4916a81fb4f733fb72336d9b85b29e6a58..8ac0d70e0fa1e01dff56665ddeb7db0553098e82 100755
--- a/tests.aarbology.sh
+++ b/tests.aarbology.sh
@@ -16,12 +16,12 @@ RAND_ALPHABET=2
 EXECUTABLES="arand2 atrim2 adeterminize2 anormalize2 "
 TESTS_DIR="`pwd`/examples2/tree"
 
-RES_GOOD=0
-RES_FAIL=0
-RES_TIME=0
-RES_SEGV=0
-RES_UNKN=0
-MATCHES=0
+RES_GOOD=
+RES_FAIL=
+RES_TIME=
+RES_SEGV=
+RES_UNKN=
+MATCHES=
 
 
 # ----------------------------
@@ -36,6 +36,11 @@ done
 cd bin-$1/
 rm -f $LOGFILE
 
+JOBS=$2
+if [ -z "$JOBS" ]; then
+	JOBS=1
+fi
+
 # ----------------------------
 
 # $1 = conv command
@@ -82,16 +87,21 @@ function runTest2 {
 		log "$2" $RET "$3" "$4" "$OUT"
 	fi
 
+	rm $3
+	rm $4
+
 	if [ $RET == 124 ]; then # timeout
+		registerResult 2
 		return 2
 	elif [ $RET -ge 124 ]; then #segv
+		registerResult 3
 		return 3
-	fi
-
-	if [ $RET != 0 ] || [ $RET2 != 0 ]; then # fail
+	elif [ $RET != 0 ] || [ $RET2 != 0 ]; then # fail
+		registerResult 1
 		return 1
 	else
-		MATCHES=$(($MATCHES + $OUT2))
+		echo -n "+$OUT2" >> $MATCHES
+		registerResult 0
 		return 0
 	fi
 }
@@ -100,40 +110,62 @@ function registerResult {
 	case $1 in
 		0)
 			echo -n "."
-			((RES_GOOD++))
+			echo -n "+1" >> $RES_GOOD
 			;;
 		1)
 			echo -n "x"
-			((RES_FAIL++))
+			echo -n "+1" >> $RES_FAIL
 			;;
 		2)
 			echo -n "T"
-			((RES_TIME++))
+			echo -n "+1" >> $RES_TIME
 			;;
 		3)
 			echo -n "E"
-			((RES_SEGV++))
+			echo -n "+1" >> $RES_SEGV
 			;;
 		*)
 			echo -n "?"
-			((RES_UNKN++))
+			echo -n "+1" >> $RES_UNKN
 			;;
 	esac
 }
 
+function initResults {
+	RES_GOOD=$(mktemp)
+	echo -n "0" > $RES_GOOD
+	RES_FAIL=$(mktemp)
+	echo -n "0" > $RES_FAIL
+	RES_TIME=$(mktemp)
+	echo -n "0" > $RES_TIME
+	RES_SEGV=$(mktemp)
+	echo -n "0" > $RES_SEGV
+	RES_UNKN=$(mktemp)
+	echo -n "0" > $RES_UNKN
+	MATCHES=$(mktemp)
+	echo -n "0" > $MATCHES
+}
+
 function clearResults {
-	RES_GOOD=0
-	RES_FAIL=0
-	RES_TIME=0
-	RES_SEGV=0
-	RES_UNKN=0
-	MATCHES=0
+	rm $RES_GOOD
+	rm $RES_FAIL
+	rm $RES_TIME
+	rm $RES_SEGV
+	rm $RES_UNKN
+	rm $MATCHES
 }
 
 function outputResults {
+	echo "" >> $RES_GOOD
+	echo "" >> $RES_FAIL
+	echo "" >> $RES_TIME
+	echo "" >> $RES_SEGV
+	echo "" >> $RES_UNKN
+	echo "" >> $MATCHES
+
 	# summary
 	echo -ne "\n\t"
-	echo "RES: GOOD:" $RES_GOOD ", FAIL:" $RES_FAIL ", TIME:" $RES_TIME ", SEGV:" $RES_SEGV, "UNKN:" $RES_UNKN, "MATCHES:" $MATCHES
+	echo "RES: GOOD:" $(bc < $RES_GOOD) ", FAIL:" $(bc < $RES_FAIL) ", TIME:" $(bc < $RES_TIME) ", SEGV:" $(bc < $RES_SEGV), "UNKN:" $(bc < $RES_UNKN), "MATCHES:" $(bc < $MATCHES)
 	echo ""
 }
 
@@ -142,39 +174,44 @@ function runTestSubtree {
 	echo $1
 	echo -ne "\t"
 
-	clearResults
+	initResults
 
 	# predefined tests first
 	for SUBJECT_FILE in `ls $TESTS_DIR/aarbology.test*.subject.xml`; do
 		PATTERN_FILE=${SUBJECT_FILE%.subject.xml}.subtree.xml
-		if [ -f  ]; then
-			Occs=`./aarbology2 -a exactSubtreeMatch -s "$SUBJECT_FILE" -p "$PATTERN_FILE" | ./astat2 -p size --set`
+		if [ -f $PATTERN_FILE ]; then
+			SUBJECT_FILE_COPY=$(mktemp)
+			PATTERN_FILE_COPY=$(mktemp)
 
-			runTest2 "$Occs" "$2" "$SUBJECT_FILE" "$PATTERN_FILE"
-			registerResult $?
+			cat $SUBJECT_FILE > $SUBJECT_FILE_COPY
+			cat $PATTERN_FILE > $PATTERN_FILE_COPY
+
+			Occs=`./aarbology2 -a exactSubtreeMatch -s "$SUBJECT_FILE_COPY" -p "$PATTERN_FILE_COPY" | ./astat2 -p size --set`
+
+			runTest2 "$Occs" "$2" "$SUBJECT_FILE_COPY" "$PATTERN_FILE_COPY"
 		fi
 	done
 
 	echo -n " | "
 
 	# random tests
-	SUBJECT_FILE=s.xml
-	PATTERN_FILE=p.xml
 	for i in $(seq 1 $TESTCASE_ITERATIONS );
 	do
+		SUBJECT_FILE=$(mktemp)
+		PATTERN_FILE=$(mktemp)
+
 		cat <(generateSubject) > $SUBJECT_FILE
 		cat <(generateSubtree) > $PATTERN_FILE
 
 		Occs=`./aarbology2 -a exactSubtreeMatch -s "$SUBJECT_FILE" -p "$PATTERN_FILE" | ./astat2 -p size --set`
 
-		runTest2 "$Occs" "$2" "$SUBJECT_FILE" "$PATTERN_FILE"
-		registerResult $?
+		runTest2 "$Occs" "$2" "$SUBJECT_FILE" "$PATTERN_FILE" & (( i%JOBS==0 )) && wait
 	done
 
-	rm $SUBJECT_FILE
-	rm $PATTERN_FILE
+	wait
 
 	outputResults
+	clearResults
 }
 
 # $1 - aconversions2 sequence
@@ -182,39 +219,44 @@ function runTestPattern {
 	echo $1
 	echo -ne "\t"
 
-	clearResults
+	initResults
 
 	# predefined tests first
 	for SUBJECT_FILE in `ls $TESTS_DIR/aarbology.test*.subject.xml`; do
 		PATTERN_FILE=${SUBJECT_FILE%.subject.xml}.pattern.xml
-		if [ -f  ]; then
-			Occs=`./aarbology2 -a exactPatternMatch -s "$SUBJECT_FILE" -p "$PATTERN_FILE" | ./astat2 -p size --set`
+		if [ -f $PATTERN_FILE ]; then
+			SUBJECT_FILE_COPY=$(mktemp)
+			PATTERN_FILE_COPY=$(mktemp)
+
+			cat $SUBJECT_FILE > $SUBJECT_FILE_COPY
+			cat $PATTERN_FILE > $PATTERN_FILE_COPY
 
-			runTest2 "$Occs" "$2" "$SUBJECT_FILE" "$PATTERN_FILE"
-			registerResult $?
+			Occs=`./aarbology2 -a exactPatternMatch -s "$SUBJECT_FILE_COPY" -p "$PATTERN_FILE_COPY" | ./astat2 -p size --set`
+
+			runTest2 "$Occs" "$2" "$SUBJECT_FILE_COPY" "$PATTERN_FILE_COPY"
 		fi
 	done
 
 	echo -n " | "
 
 	# random tests
-	SUBJECT_FILE=s.xml
-	PATTERN_FILE=p.xml
 	for i in $(seq 1 $TESTCASE_ITERATIONS );
 	do
+		SUBJECT_FILE=$(mktemp)
+		PATTERN_FILE=$(mktemp)
+
 		cat <(generateSubject) > $SUBJECT_FILE
 		cat <(generatePattern) > $PATTERN_FILE
 
 		Occs=`./aarbology2 -a exactPatternMatch -s "$SUBJECT_FILE" -p "$PATTERN_FILE" | ./astat2 -p size --set`
 
-		runTest2 "$Occs" "$2" "$SUBJECT_FILE" "$PATTERN_FILE"
-		registerResult $?
+		runTest2 "$Occs" "$2" "$SUBJECT_FILE" "$PATTERN_FILE" & (( i%JOBS==0 )) && wait
 	done
 
-	rm $SUBJECT_FILE
-	rm $PATTERN_FILE
+	wait
 
 	outputResults
+	clearResults
 }
 
 # $1 - aconversions2 sequence
@@ -222,39 +264,44 @@ function runTestPatternEnds {
 	echo $1
 	echo -ne "\t"
 
-	clearResults
+	initResults
 
 	# predefined tests first
 	for SUBJECT_FILE in `ls $TESTS_DIR/aarbology.test*.subject.xml`; do
 		PATTERN_FILE=${SUBJECT_FILE%.subject.xml}.pattern.xml
-		if [ -f  ]; then
-			Occs=`./aarbology2 -e -a exactPatternMatch -s <(./acast2 -t PrefixRankedTree -i "$SUBJECT_FILE" ) -p <(./acast2 -t PrefixRankedPattern -i "$PATTERN_FILE" ) | ./astat2 -p size --set`
+		if [ -f $PATTERN_FILE ]; then
+			SUBJECT_FILE_COPY=$(mktemp)
+			PATTERN_FILE_COPY=$(mktemp)
+
+			cat $SUBJECT_FILE > $SUBJECT_FILE_COPY
+			cat $PATTERN_FILE > $PATTERN_FILE_COPY
+
+			Occs=`./aarbology2 -e -a exactPatternMatch -s <(./acast2 -t PrefixRankedTree -i "$SUBJECT_FILE_COPY" ) -p <(./acast2 -t PrefixRankedPattern -i "$PATTERN_FILE_COPY" ) | ./astat2 -p size --set`
 
-			runTest2 "$Occs" "$2" "$SUBJECT_FILE" "$PATTERN_FILE"
-			registerResult $?
+			runTest2 "$Occs" "$2" "$SUBJECT_FILE_COPY" "$PATTERN_FILE_COPY"
 		fi
 	done
 
 	echo -n " | "
 
 	# random tests
-	SUBJECT_FILE=s.xml
-	PATTERN_FILE=p.xml
 	for i in $(seq 1 $TESTCASE_ITERATIONS );
 	do
+		SUBJECT_FILE=$(mktemp)
+		PATTERN_FILE=$(mktemp)
+
 		cat <(generateSubject) > $SUBJECT_FILE
 		cat <(generatePattern) > $PATTERN_FILE
 
 		Occs=`./aarbology2 -e -a exactPatternMatch -s <(./acast2 -t PrefixRankedTree -i "$SUBJECT_FILE" ) -p <(./acast2 -t PrefixRankedPattern -i "$PATTERN_FILE" ) | ./astat2 -p size --set`
 
-		runTest2 "$Occs" "$2" "$SUBJECT_FILE" "$PATTERN_FILE"
-		registerResult $?
+		runTest2 "$Occs" "$2" "$SUBJECT_FILE" "$PATTERN_FILE" & (( i%JOBS==0 )) && wait
 	done
 
-	rm $SUBJECT_FILE
-	rm $PATTERN_FILE
+	wait
 
 	outputResults
+	clearResults
 }
 
 runTestPatternEnds "Exact Pattern Matching Automaton (PrefixRanked)" "./aarbology2 -a exactPatternMatchingAutomaton -p <(./acast2 -t PrefixRankedPattern -i <(./alphabetManip2 -o add -i \"\$PATTERN_FILE\" -a <( ./alphabetManip2 -o get -i \"\$SUBJECT_FILE\" ) ) ) | ./adeterminize2 | ./arun2 -t occurrences -a - -i <( ./acast2 -t PrefixRankedTree -i \"\$SUBJECT_FILE\" | ./acast2 -t LinearString ) | ./astat2 -p size --set"
diff --git a/tests.aconversion.sh b/tests.aconversion.sh
index 2558e1214d609a184b1e60cc962efbf239289e3a..3ee5acffb9d8ec5e87c8da383d5fa0b021a048f1 100755
--- a/tests.aconversion.sh
+++ b/tests.aconversion.sh
@@ -14,11 +14,11 @@ RAND_ALPHABET=4
 EXECUTABLES="arand2 aepsilon2 atrim2 adeterminize2 aminimize2 anormalize2 acompare2 aconversions2"
 TESTS_DIR="`pwd`/examples2/automaton"
 
-RES_GOOD=0
-RES_FAIL=0
-RES_TIME=0
-RES_SEGV=0
-RES_UNKN=0
+RES_GOOD=
+RES_FAIL=
+RES_TIME=
+RES_SEGV=
+RES_UNKN=
 
 
 # ----------------------------
@@ -33,6 +33,11 @@ done
 cd bin-$1/
 rm -f $LOGFILE
 
+JOBS=$2
+if [ -z "$JOBS" ]; then
+	JOBS=1
+fi
+
 # ----------------------------
 
 # $1 = conv command
@@ -61,18 +66,24 @@ function runTest2 {
 	OUT=`timeout $TESTCASE_TIMEOUT bash -c "./acompare2 <(cat $2 | $1 | $MDFA ) <(cat $2 | $MDFA)"`
 	RET=$?
 
-	if [ $RET == 0 ]; then # ok
-		return 0
+	if [ $RET != 0 ]; then # fail
+		log "$1" $RET "$2" "$OUT"
 	fi
 
-	log "$1" $RET "$2" "$OUT"
+	rm $2
 
 	if [ $RET == 124 ]; then # timeout
+		registerResult 2
 		return 2
 	elif [ $RET -ge 124 ]; then #segv
+		registerResult 3
 		return 3
-	else
+	elif [ $RET != 0 ]; then # fail
+		registerResult 1
 		return 1
+	else
+		registerResult 0
+		return 0
 	fi
 }
 
@@ -80,39 +91,58 @@ function registerResult {
 	case $1 in
 		0)
 			echo -n "."
-			((RES_GOOD++))
+			echo -n "+1" >> $RES_GOOD
 			;;
 		1)
 			echo -n "x"
-			((RES_FAIL++))
+			echo -n "+1" >> $RES_FAIL
 			;;
 		2)
 			echo -n "T"
-			((RES_TIME++))
+			echo -n "+1" >> $RES_TIME
 			;;
 		3)
 			echo -n "E"
-			((RES_SEGV++))
+			echo -n "+1" >> $RES_SEGV
 			;;
 		*)
 			echo -n "?"
-			((RES_UNKN++))
+			echo -n "+1" >> $RES_UNKN
 			;;
 	esac
 }
 
+function initResults {
+	RES_GOOD=$(mktemp)
+	echo -n "0" > $RES_GOOD
+	RES_FAIL=$(mktemp)
+	echo -n "0" > $RES_FAIL
+	RES_TIME=$(mktemp)
+	echo -n "0" > $RES_TIME
+	RES_SEGV=$(mktemp)
+	echo -n "0" > $RES_SEGV
+	RES_UNKN=$(mktemp)
+	echo -n "0" > $RES_UNKN
+}
+
 function clearResults {
-	RES_GOOD=0
-	RES_FAIL=0
-	RES_TIME=0
-	RES_SEGV=0
-	RES_UNKN=0
+	rm $RES_GOOD
+	rm $RES_FAIL
+	rm $RES_TIME
+	rm $RES_SEGV
+	rm $RES_UNKN
 }
 
 function outputResults {
+	echo "" >> $RES_GOOD
+	echo "" >> $RES_FAIL
+	echo "" >> $RES_TIME
+	echo "" >> $RES_SEGV
+	echo "" >> $RES_UNKN
+
 	# summary
 	echo -ne "\n\t"
-	echo "RES: GOOD:" $RES_GOOD ", FAIL:" $RES_FAIL ", TIME:" $RES_TIME ", SEGV:" $RES_SEGV, "UNKN:" $RES_UNKN
+	echo "RES: GOOD:" $(bc < $RES_GOOD) ", FAIL:" $(bc < $RES_FAIL) ", TIME:" $(bc < $RES_TIME) ", SEGV:" $(bc < $RES_SEGV), "UNKN:" $(bc < $RES_UNKN)
 	echo ""
 }
 
@@ -121,29 +151,33 @@ function runTest {
 	echo $1
 	echo -ne "\t"
 
-	clearResults
+	initResults
 
 	# predefined tests first
 	for FILE in `ls $TESTS_DIR/aconversion.test*`; do
-		runTest2 "$1" "$FILE"
-		registerResult $?
+		FILE_COPY=$(mktemp)
+
+		cat $FILE > $FILE_COPY
+
+		runTest2 "$1" "$FILE_COPY"
 	done
 
 	echo -n " | "
 
 	# random tests
-	NFA_FILE=nfa.xml
 	for i in $(seq 1 $TESTCASE_ITERATIONS );
 	do
+		NFA_FILE=$(mktemp)
+
 		cat <(generateNFA) > $NFA_FILE
 
-		runTest2 "$1" "$NFA_FILE"
-		registerResult $?
+		runTest2 "$1" "$NFA_FILE" & (( i%JOBS==0 )) && wait
 	done
 
-	rm $NFA_FILE
+	wait
 
 	outputResults
+	clearResults
 }
 
 # FA -> RG -> FA
diff --git a/tests.adeterminize.sh b/tests.adeterminize.sh
index 6fe0e0e05ca2d6b3283a0ee7bf2a0b55fa4091c7..99e448f6aa70da3394f89f205b5975d9c0bb37ca 100755
--- a/tests.adeterminize.sh
+++ b/tests.adeterminize.sh
@@ -9,11 +9,11 @@ LOGFILE="log_tests.txt"
 EXECUTABLES="aepsilon2 atrim2 adeterminize2 aminimize2 anormalize2 acompare2"
 TESTS_DIR="`pwd`/examples2/automaton"
 
-RES_GOOD=0
-RES_FAIL=0
-RES_TIME=0
-RES_SEGV=0
-RES_UNKN=0
+RES_GOOD=
+RES_FAIL=
+RES_TIME=
+RES_SEGV=
+RES_UNKN=
 
 
 # ----------------------------
@@ -71,39 +71,58 @@ function registerResult {
 	case $1 in
 		0)
 			echo -n "."
-			((RES_GOOD++))
+			echo -n "+1" >> $RES_GOOD
 			;;
 		1)
 			echo -n "x"
-			((RES_FAIL++))
+			echo -n "+1" >> $RES_FAIL
 			;;
 		2)
 			echo -n "T"
-			((RES_TIME++))
+			echo -n "+1" >> $RES_TIME
 			;;
 		3)
 			echo -n "E"
-			((RES_SEGV++))
+			echo -n "+1" >> $RES_SEGV
 			;;
 		*)
 			echo -n "?"
-			((RES_UNKN++))
+			echo -n "+1" >> $RES_UNKN
 			;;
 	esac
 }
 
+function initResults {
+	RES_GOOD=$(mktemp)
+	echo -n "0" > $RES_GOOD
+	RES_FAIL=$(mktemp)
+	echo -n "0" > $RES_FAIL
+	RES_TIME=$(mktemp)
+	echo -n "0" > $RES_TIME
+	RES_SEGV=$(mktemp)
+	echo -n "0" > $RES_SEGV
+	RES_UNKN=$(mktemp)
+	echo -n "0" > $RES_UNKN
+}
+
 function clearResults {
-	RES_GOOD=0
-	RES_FAIL=0
-	RES_TIME=0
-	RES_SEGV=0
-	RES_UNKN=0
+	rm $RES_GOOD
+	rm $RES_FAIL
+	rm $RES_TIME
+	rm $RES_SEGV
+	rm $RES_UNKN
 }
 
 function outputResults {
+	echo "" >> $RES_GOOD
+	echo "" >> $RES_FAIL
+	echo "" >> $RES_TIME
+	echo "" >> $RES_SEGV
+	echo "" >> $RES_UNKN
+
 	# summary
 	echo -ne "\n\t"
-	echo "RES: GOOD:" $RES_GOOD ", FAIL:" $RES_FAIL ", TIME:" $RES_TIME ", SEGV:" $RES_SEGV, "UNKN:" $RES_UNKN
+	echo "RES: GOOD:" $(bc < $RES_GOOD) ", FAIL:" $(bc < $RES_FAIL) ", TIME:" $(bc < $RES_TIME) ", SEGV:" $(bc < $RES_SEGV), "UNKN:" $(bc < $RES_UNKN)
 	echo ""
 }
 
@@ -112,7 +131,7 @@ function runTest {
 	echo $1 \($2\)
 	echo -ne "\t"
 
-	clearResults
+	initResults
 
 	# predefined tests first
 	for FILE in `ls $TESTS_DIR/$1*.xml | grep -v DET`; do
@@ -124,6 +143,7 @@ function runTest {
 	done
 
 	outputResults
+	clearResults
 }
 
 runTest "NFSM" "./adeterminize2 | ./atrim2"
diff --git a/tests.anormalize.sh b/tests.anormalize.sh
index 4a8617fafa0ee2e85a924a2928f8dcc8db52ac52..8172238f1ac74e541009738f60da4b0c3b0285ff 100755
--- a/tests.anormalize.sh
+++ b/tests.anormalize.sh
@@ -15,11 +15,11 @@ STRING_LENGHTS=6
 EXECUTABLES="arand2 atrim2 anormalize2 agenerate2 aepsilon2"
 TESTS_DIR="`pwd`/examples2/grammar"
 
-RES_GOOD=0
-RES_FAIL=0
-RES_TIME=0
-RES_SEGV=0
-RES_UNKN=0
+RES_GOOD=
+RES_FAIL=
+RES_TIME=
+RES_SEGV=
+RES_UNKN=
 
 
 # ----------------------------
@@ -34,6 +34,11 @@ done
 cd bin-$1/
 rm -f $LOGFILE
 
+JOBS=$2
+if [ -z "$JOBS" ]; then
+	JOBS=1
+fi
+
 # ----------------------------
 
 # $1 = conv command
@@ -62,18 +67,24 @@ function runTest2 {
 	OUT=`timeout $TESTCASE_TIMEOUT bash -c "diff <(cat $2 | $1 | $GENERATED_STRINGS ) <(cat $2 | $GENERATED_STRINGS)"`
 	RET=$?
 
-	if [ $RET == 0 ]; then # ok
-		return 0
+	if [ $RET != 0 ]; then # fail
+		log "$1" $RET "$2" "$OUT"
 	fi
 
-	log "$1" $RET "$2" "$OUT"
+	rm $2
 
 	if [ $RET == 124 ]; then # timeout
+		registerResult 2
 		return 2
 	elif [ $RET -ge 124 ]; then #segv
+		registerResult 3
 		return 3
-	else
+	elif [ $RET != 0 ]; then # fail
+		registerResult 1
 		return 1
+	else
+		registerResult 0
+		return 0
 	fi
 }
 
@@ -81,39 +92,58 @@ function registerResult {
 	case $1 in
 		0)
 			echo -n "."
-			((RES_GOOD++))
+			echo -n "+1" >> $RES_GOOD
 			;;
 		1)
 			echo -n "x"
-			((RES_FAIL++))
+			echo -n "+1" >> $RES_FAIL
 			;;
 		2)
 			echo -n "T"
-			((RES_TIME++))
+			echo -n "+1" >> $RES_TIME
 			;;
 		3)
 			echo -n "E"
-			((RES_SEGV++))
+			echo -n "+1" >> $RES_SEGV
 			;;
 		*)
 			echo -n "?"
-			((RES_UNKN++))
+			echo -n "+1" >> $RES_UNKN
 			;;
 	esac
 }
 
+function initResults {
+	RES_GOOD=$(mktemp)
+	echo -n "0" > $RES_GOOD
+	RES_FAIL=$(mktemp)
+	echo -n "0" > $RES_FAIL
+	RES_TIME=$(mktemp)
+	echo -n "0" > $RES_TIME
+	RES_SEGV=$(mktemp)
+	echo -n "0" > $RES_SEGV
+	RES_UNKN=$(mktemp)
+	echo -n "0" > $RES_UNKN
+}
+
 function clearResults {
-	RES_GOOD=0
-	RES_FAIL=0
-	RES_TIME=0
-	RES_SEGV=0
-	RES_UNKN=0
+	rm $RES_GOOD
+	rm $RES_FAIL
+	rm $RES_TIME
+	rm $RES_SEGV
+	rm $RES_UNKN
 }
 
 function outputResults {
+	echo "" >> $RES_GOOD
+	echo "" >> $RES_FAIL
+	echo "" >> $RES_TIME
+	echo "" >> $RES_SEGV
+	echo "" >> $RES_UNKN
+
 	# summary
 	echo -ne "\n\t"
-	echo "RES: GOOD:" $RES_GOOD ", FAIL:" $RES_FAIL ", TIME:" $RES_TIME ", SEGV:" $RES_SEGV, "UNKN:" $RES_UNKN
+	echo "RES: GOOD:" $(bc < $RES_GOOD) ", FAIL:" $(bc < $RES_FAIL) ", TIME:" $(bc < $RES_TIME) ", SEGV:" $(bc < $RES_SEGV), "UNKN:" $(bc < $RES_UNKN)
 	echo ""
 }
 
@@ -122,29 +152,33 @@ function runTest {
 	echo $1
 	echo -ne "\t"
 
-	clearResults
+	initResults
 
 	# predefined tests first
 	for FILE in `ls $TESTS_DIR/anormalization.test*`; do
-		runTest2 "$1" "$FILE"
-		registerResult $?
+		FILE_COPY=$(mktemp)
+
+		cat $FILE > $FILE_COPY
+
+		runTest2 "$1" "$FILE_COPY"
 	done
 
 	echo -n " | "
 
 	# random tests
-	CFG_FILE=cfg.xml
 	for i in $(seq 1 $TESTCASE_ITERATIONS );
 	do
+		CFG_FILE=$(mktemp)
+
 		cat <(generateCFG) > $CFG_FILE
 
-		runTest2 "$1" "$CFG_FILE"
-		registerResult $?
+		runTest2 "$1" "$CFG_FILE" & (( i%JOBS==0 )) && wait
 	done
 
-	rm $CFG_FILE
+	wait
 
 	outputResults
+	clearResults
 }
 
 # Chomsky normal form and Greibach normal form
diff --git a/tests.astringology.sh b/tests.astringology.sh
index e7c81eb24659ea155f8818645241d2715ae4a517..e77dc921a8977caaad220d6cad6d6fc2f97795fe 100755
--- a/tests.astringology.sh
+++ b/tests.astringology.sh
@@ -14,12 +14,12 @@ RAND_ALPHABET=4
 EXECUTABLES="arand2 atrim2 adeterminize2 anormalize2 "
 TESTS_DIR="`pwd`/examples2/string"
 
-RES_GOOD=0
-RES_FAIL=0
-RES_TIME=0
-RES_SEGV=0
-RES_UNKN=0
-MATCHES=0
+RES_GOOD=
+RES_FAIL=
+RES_TIME=
+RES_SEGV=
+RES_UNKN=
+MATCHES=
 
 
 # ----------------------------
@@ -34,6 +34,11 @@ done
 cd bin-$1/
 rm -f $LOGFILE
 
+JOBS=$2
+if [ -z "$JOBS" ]; then
+	JOBS=1
+fi
+
 # ----------------------------
 
 # $1 = conv command
@@ -76,16 +81,21 @@ function runTest2 {
 		log "$2" $RET "$3" "$4" "$OUT"
 	fi
 
+	rm $3
+	rm $4
+
 	if [ $RET == 124 ]; then # timeout
+		registerResult 2
 		return 2
 	elif [ $RET -ge 124 ]; then #segv
+		registerResult 3
 		return 3
-	fi
-
-	if [ $RET != 0 ] || [ $RET2 != 0 ]; then # fail
+	elif [ $RET != 0 ] || [ $RET2 != 0 ]; then # fail
+		registerResult 1
 		return 1
 	else
-		MATCHES=$(($MATCHES + $OUT2))
+		echo -n "+$OUT2" >> $MATCHES
+		registerResult 0
 		return 0
 	fi
 }
@@ -94,40 +104,62 @@ function registerResult {
 	case $1 in
 		0)
 			echo -n "."
-			((RES_GOOD++))
+			echo -n "+1" >> $RES_GOOD
 			;;
 		1)
 			echo -n "x"
-			((RES_FAIL++))
+			echo -n "+1" >> $RES_FAIL
 			;;
 		2)
 			echo -n "T"
-			((RES_TIME++))
+			echo -n "+1" >> $RES_TIME
 			;;
 		3)
 			echo -n "E"
-			((RES_SEGV++))
+			echo -n "+1" >> $RES_SEGV
 			;;
 		*)
 			echo -n "?"
-			((RES_UNKN++))
+			echo -n "+1" >> $RES_UNKN
 			;;
 	esac
 }
 
+function initResults {
+	RES_GOOD=$(mktemp)
+	echo -n "0" > $RES_GOOD
+	RES_FAIL=$(mktemp)
+	echo -n "0" > $RES_FAIL
+	RES_TIME=$(mktemp)
+	echo -n "0" > $RES_TIME
+	RES_SEGV=$(mktemp)
+	echo -n "0" > $RES_SEGV
+	RES_UNKN=$(mktemp)
+	echo -n "0" > $RES_UNKN
+	MATCHES=$(mktemp)
+	echo -n "0" > $MATCHES
+}
+
 function clearResults {
-	RES_GOOD=0
-	RES_FAIL=0
-	RES_TIME=0
-	RES_SEGV=0
-	RES_UNKN=0
-	MATCHES=0
+	rm $RES_GOOD
+	rm $RES_FAIL
+	rm $RES_TIME
+	rm $RES_SEGV
+	rm $RES_UNKN
+	rm $MATCHES
 }
 
 function outputResults {
+	echo "" >> $RES_GOOD
+	echo "" >> $RES_FAIL
+	echo "" >> $RES_TIME
+	echo "" >> $RES_SEGV
+	echo "" >> $RES_UNKN
+	echo "" >> $MATCHES
+
 	# summary
 	echo -ne "\n\t"
-	echo "RES: GOOD:" $RES_GOOD ", FAIL:" $RES_FAIL ", TIME:" $RES_TIME ", SEGV:" $RES_SEGV, "UNKN:" $RES_UNKN, "MATCHES:" $MATCHES
+	echo "RES: GOOD:" $(bc < $RES_GOOD) ", FAIL:" $(bc < $RES_FAIL) ", TIME:" $(bc < $RES_TIME) ", SEGV:" $(bc < $RES_SEGV), "UNKN:" $(bc < $RES_UNKN), "MATCHES:" $(bc < $MATCHES)
 	echo ""
 }
 
@@ -136,39 +168,44 @@ function runTest {
 	echo $1
 	echo -ne "\t"
 
-	clearResults
+	initResults
 
 	# predefined tests first
 	for SUBJECT_FILE in `ls $TESTS_DIR/astringology.test*.subject.xml`; do
 		PATTERN_FILE=${SUBJECT_FILE%.subject.xml}.pattern.xml
-		if [ -f  ]; then
-			Occs=`./astringology2 -a exactFactorMatch -s "$SUBJECT_FILE" -p "$PATTERN_FILE" | ./astat2 -p size --set`
+		if [ -f $PATTERN_FILE ]; then
+			SUBJECT_FILE_COPY=$(mktemp)
+			PATTERN_FILE_COPY=$(mktemp)
+
+			cat $SUBJECT_FILE > $SUBJECT_FILE_COPY
+			cat $PATTERN_FILE > $PATTERN_FILE_COPY
 
-			runTest2 "$Occs" "$2" "$SUBJECT_FILE" "$PATTERN_FILE"
-			registerResult $?
+			Occs=`./astringology2 -a exactFactorMatch -s "$SUBJECT_FILE_COPY" -p "$PATTERN_FILE_COPY" | ./astat2 -p size --set`
+
+			runTest2 "$Occs" "$2" "$SUBJECT_FILE_COPY" "$PATTERN_FILE_COPY"
 		fi
 	done
 
 	echo -n " | "
 
 	# random tests
-	SUBJECT_FILE=s.xml
-	PATTERN_FILE=p.xml
 	for i in $(seq 1 $TESTCASE_ITERATIONS );
 	do
+		SUBJECT_FILE=$(mktemp)
+		PATTERN_FILE=$(mktemp)
+
 		cat <(generateSubject) > $SUBJECT_FILE
 		cat <(generatePattern) > $PATTERN_FILE
 
 		Occs=`./astringology2 -a exactFactorMatch -s "$SUBJECT_FILE" -p "$PATTERN_FILE" | ./astat2 -p size --set`
 
-		runTest2 "$Occs" "$2" "$SUBJECT_FILE" "$PATTERN_FILE"
-		registerResult $?
+		runTest2 "$Occs" "$2" "$SUBJECT_FILE" "$PATTERN_FILE" & (( i%JOBS==0 )) && wait
 	done
 
-	rm $SUBJECT_FILE
-	rm $PATTERN_FILE
+	wait
 
 	outputResults
+	clearResults
 }
 
 runTest "Exact Boyer Moore Horspool" "./astringology2 -a boyerMooreHorspool -s \"\$SUBJECT_FILE\" -p <(./alphabetManip2 -o add -i \"\$PATTERN_FILE\" -a <(./alphabetManip2 -o get -i \"\$SUBJECT_FILE\")) | ./astat2 -p size --set"
diff --git a/tests.examples.sh b/tests.examples.sh
index 4f6dc10747fdfa2ba20f3e7055e365ee9bfce4a3..d41ee32cd30b9fb495d97fd1a72e5500fbf38b4c 100755
--- a/tests.examples.sh
+++ b/tests.examples.sh
@@ -9,11 +9,11 @@ LOGFILE="log_tests.txt"
 EXECUTABLES="aecho2"
 TESTS_DIR="`pwd`/examples2"
 
-RES_GOOD=0
-RES_FAIL=0
-RES_TIME=0
-RES_SEGV=0
-RES_UNKN=0
+RES_GOOD=
+RES_FAIL=
+RES_TIME=
+RES_SEGV=
+RES_UNKN=
 
 
 # ----------------------------
@@ -69,39 +69,58 @@ function registerResult {
 	case $1 in
 		0)
 			echo -n "."
-			((RES_GOOD++))
+			echo -n "+1" >> $RES_GOOD
 			;;
 		1)
 			echo -n "x"
-			((RES_FAIL++))
+			echo -n "+1" >> $RES_FAIL
 			;;
 		2)
 			echo -n "T"
-			((RES_TIME++))
+			echo -n "+1" >> $RES_TIME
 			;;
 		3)
 			echo -n "E"
-			((RES_SEGV++))
+			echo -n "+1" >> $RES_SEGV
 			;;
 		*)
 			echo -n "?"
-			((RES_UNKN++))
+			echo -n "+1" >> $RES_UNKN
 			;;
 	esac
 }
 
+function initResults {
+	RES_GOOD=$(mktemp)
+	echo -n "0" > $RES_GOOD
+	RES_FAIL=$(mktemp)
+	echo -n "0" > $RES_FAIL
+	RES_TIME=$(mktemp)
+	echo -n "0" > $RES_TIME
+	RES_SEGV=$(mktemp)
+	echo -n "0" > $RES_SEGV
+	RES_UNKN=$(mktemp)
+	echo -n "0" > $RES_UNKN
+}
+
 function clearResults {
-	RES_GOOD=0
-	RES_FAIL=0
-	RES_TIME=0
-	RES_SEGV=0
-	RES_UNKN=0
+	rm $RES_GOOD
+	rm $RES_FAIL
+	rm $RES_TIME
+	rm $RES_SEGV
+	rm $RES_UNKN
 }
 
 function outputResults {
+	echo "" >> $RES_GOOD
+	echo "" >> $RES_FAIL
+	echo "" >> $RES_TIME
+	echo "" >> $RES_SEGV
+	echo "" >> $RES_UNKN
+
 	# summary
 	echo -ne "\n\t"
-	echo "RES: GOOD:" $RES_GOOD ", FAIL:" $RES_FAIL ", TIME:" $RES_TIME ", SEGV:" $RES_SEGV, "UNKN:" $RES_UNKN
+	echo "RES: GOOD:" $(bc < $RES_GOOD) ", FAIL:" $(bc < $RES_FAIL) ", TIME:" $(bc < $RES_TIME) ", SEGV:" $(bc < $RES_SEGV), "UNKN:" $(bc < $RES_UNKN)
 	echo ""
 }
 
@@ -110,7 +129,7 @@ function runTest {
 	echo $1 \(./aecho2\)
 	echo -ne "\t"
 
-	clearResults
+	initResults
 
 	# predefined tests first
 	for FILE in `ls $TESTS_DIR/$1/*.xml`; do
@@ -119,6 +138,7 @@ function runTest {
 	done
 
 	outputResults
+	clearResults
 }
 
 runTest "automaton"