diff --git a/alib2data/src/tree/ranked/PostfixRankedTree.h b/alib2data/src/tree/ranked/PostfixRankedTree.h
index 887be8606630a0956738dc321a02d461b7d28c6c..0b7fc0b9af6c489cc5e98f3f6ca7d2af0a4100f3 100644
--- a/alib2data/src/tree/ranked/PostfixRankedTree.h
+++ b/alib2data/src/tree/ranked/PostfixRankedTree.h
@@ -53,7 +53,7 @@ class GeneralAlphabet;
 
 /**
  * \brief
- * Tree structure represented as linear sequece as result of postorder traversal. The representation is so called ranked, therefore it consists of ranked symbols. The rank of the ranked symbol need to compatible with unsigned integer.
+ * Tree structure represented as linear sequece as result of postorder traversal. The representation is so called ranked, therefore it consists of ranked symbols. The rank of the ranked symbol needs to be compatible with unsigned integer.
 
  * \details
  * T = (A, C),
diff --git a/alib2data/src/tree/ranked/PrefixRankedBarNonlinearPattern.h b/alib2data/src/tree/ranked/PrefixRankedBarNonlinearPattern.h
index 8111b288b645a15c584db8231b46fc7d3a117c86..a342420eec1b29b545e4c57acc316f97f041c0f0 100644
--- a/alib2data/src/tree/ranked/PrefixRankedBarNonlinearPattern.h
+++ b/alib2data/src/tree/ranked/PrefixRankedBarNonlinearPattern.h
@@ -61,7 +61,7 @@ class NonlinearAlphabet;
 
 /**
  * \brief
- * Nonlinear tree pattern represented as linear sequece as result of preorder traversal with additional bar symbols. The representation is so called ranked, therefore it consists of ranked symbols (bars are ranked as well). The rank of the ranked symbol need to compatible with unsigned integer. Additionally the pattern contains a special wildcard symbol representing any subtree and nonlinear variables each to represent same subtree (in the particular occurrence in a tree). To match the wildcard and nonlinear variable, special bar symbol called variables bar is present as well.
+ * Nonlinear tree pattern represented as linear sequece as result of preorder traversal with additional bar symbols. The representation is so called ranked, therefore it consists of ranked symbols (bars are ranked as well). The rank of the ranked symbol needs be to compatible with unsigned integer. Additionally the pattern contains a special wildcard symbol representing any subtree and nonlinear variables each to represent same subtree (in the particular occurrence in a tree). To match the wildcard and nonlinear variable, special bar symbol called variables bar is present as well.
  *
  * The bars represent end mark of all subpatterns in the notation.
  *
@@ -96,7 +96,7 @@ public:
 	 * \brief Creates a new instance of the pattern with concrete alphabet, bars, content, wildcard, nonlinear variables, and variables bar.
 	 *
 	 * \param bars the initial bar set
-	 * \param variables bar the initial variables bar
+	 * \param variablesBar the initial variables bar
 	 * \param subtreeWildcard the wildcard symbol
 	 * \param nonlinearVariables the set of nonlinear variables
 	 * \param alphabet the initial alphabet of the pattern
@@ -108,7 +108,7 @@ public:
 	 * \brief Creates a new instance of the pattern with concrete bars, content, wildcard, nonlinear variables, and variables bar. The alphabet is deduced from the content.
 	 *
 	 * \param bars the initial bar set
-	 * \param variables bar the initial variables bar
+	 * \param variablesBar the initial variables bar
 	 * \param subtreeWildcard the wildcard symbol
 	 * \param nonlinearVariables the set of nonlinear variables
 	 * \param data the initial pattern in linear representation
@@ -119,7 +119,7 @@ public:
 	 * \brief Creates a new instance of the pattern with concrete bars, content, wildcard, and variables bar. The alphabet is deduced from the content. Nonlinear variables are defaultly constructed to empty set.
 	 *
 	 * \param bars the initial bar set
-	 * \param variables bar the initial variables bar
+	 * \param variablesBar the initial variables bar
 	 * \param subtreeWildcard the wildcard symbol
 	 * \param data the initial pattern in linear representation
 	 */
@@ -129,7 +129,7 @@ public:
 	 * \brief Creates a new instance of the pattern based on the RankedTree. The linear representation is constructed (including bars) by preorder traversal on the tree parameter. Symbol part of bars and variables bar are provided as parameters. The subtree wildcard is defaultly constructed and nonlinear variables are defaultly constructed to empty set.
 	 *
 	 * \param barBase the symbol part of all bars
-	 * \param variables bar the initial variables bar
+	 * \param variablesBar the initial variables bar
 	 * \param tree representation of a tree.
 	 */
 	explicit PrefixRankedBarNonlinearPattern ( SymbolType barBase, common::ranked_symbol < SymbolType, RankType > variablesBar, const RankedTree < SymbolType, RankType > & tree );
@@ -138,7 +138,7 @@ public:
 	 * \brief Creates a new instance of the pattern based on the RankedPattern. The linear representation is constructed (including bars) by preorder traversal on the tree parameter. Symbol part of bars and variables bar are provided as parameters. The subtree wildcard is provided by the pattern parameter and nonlinear variables are defaultly constructed to empty set.
 	 *
 	 * \param barBase the symbol part of all bars
-	 * \param variables bar the initial variables bar
+	 * \param variablesBar the initial variables bar
 	 * \param tree representation of a pattern.
 	 */
 	explicit PrefixRankedBarNonlinearPattern ( SymbolType barBase, common::ranked_symbol < SymbolType, RankType > variablesBar, const RankedPattern < SymbolType, RankType > & tree );
@@ -147,7 +147,7 @@ public:
 	 * \brief Creates a new instance of the pattern based on the RankedNonlinearPattern. The linear representation is constructed (including bars) by preorder traversal on the tree parameter. Symbol part of bars and variables bar are provided as parameters. The subtree wildcard and nonlinear variables are provided by the pattern parameter.
 	 *
 	 * \param barBase the symbol part of all bars
-	 * \param variables bar the initial variables bar
+	 * \param variablesBar the initial variables bar
 	 * \param tree representation of a pattern.
 	 */
 	explicit PrefixRankedBarNonlinearPattern ( SymbolType barBase, common::ranked_symbol < SymbolType, RankType > variablesBar, const RankedNonlinearPattern < SymbolType, RankType > & tree );
@@ -693,7 +693,7 @@ template < class SymbolType, class RankType >
 class SetConstraint< tree::PrefixRankedBarNonlinearPattern < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, tree::NonlinearAlphabet > {
 public:
 	/**
-	 * Returns false. Nonlinear symbol is only a mark that the pattern itself does require further. //FIXME it is however followed by variables bar... Maybe get rid of it?
+	 * Returns false. Nonlinear symbol is only a mark that the pattern itself does require further. //FIXME it is however followed by variables bar... Maybe get rid of the variables bar?
 	 *
 	 * \param pattern the tested pattern
 	 * \param symbol the tested symbol
@@ -705,7 +705,7 @@ public:
 	}
 
 	/**
-	 * Returns true as all symbols are possibly available to be in a nonlinear alphabet.
+	 * Determines whether the symbol is available in the pattern's alphabet.
 	 *
 	 * \param pattern the tested pattern
 	 * \param symbol the tested symbol
diff --git a/alib2data/src/tree/ranked/PrefixRankedBarPattern.h b/alib2data/src/tree/ranked/PrefixRankedBarPattern.h
index 03aaffea61ea81ed1f4d194a374a3d144960451d..cb9fde40f5a00458027449adcc644265e94f5935 100644
--- a/alib2data/src/tree/ranked/PrefixRankedBarPattern.h
+++ b/alib2data/src/tree/ranked/PrefixRankedBarPattern.h
@@ -60,7 +60,7 @@ class VariablesBarSymbol;
 
 /**
  * \brief
- * Tree pattern represented as linear sequece as result of preorder traversal with additional bar symbols. The representation is so called ranked, therefore it consists of ranked symbols (bars are ranked as well). The rank of the ranked symbol need to compatible with unsigned integer. Additionally the pattern contains a special wildcard symbol representing any subtree. To match the wildcard, special bar symbol called variables bar is present as well.
+ * Tree pattern represented as linear sequece as result of preorder traversal with additional bar symbols. The representation is so called ranked, therefore it consists of ranked symbols (bars are ranked as well). The rank of the ranked symbol needs to be compatible with unsigned integer. Additionally the pattern contains a special wildcard symbol representing any subtree. To match the wildcard, special bar symbol called variables bar is present as well.
  *
  * The bars represent end mark of all subpatterns in the notation.
  *
@@ -94,7 +94,7 @@ public:
 	 * \brief Creates a new instance of the pattern with concrete alphabet, bars, content, wildcard, and variables bar.
 	 *
 	 * \param bars the initial bar set
-	 * \param variables bar the initial variables bar
+	 * \param variablesBar the initial variables bar
 	 * \param subtreeWildcard the wildcard symbol
 	 * \param alphabet the initial alphabet of the pattern
 	 * \param data the initial pattern in linear representation
@@ -102,10 +102,10 @@ public:
 	explicit PrefixRankedBarPattern ( ext::set < common::ranked_symbol < SymbolType, RankType > > bar, common::ranked_symbol < SymbolType, RankType > variablesBar, common::ranked_symbol < SymbolType, RankType > subtreeWildcard, ext::set < common::ranked_symbol < SymbolType, RankType > > alphabet, ext::vector < common::ranked_symbol < SymbolType, RankType > > data );
 
 	/**
-	 * \brief Creates a new instance of the pattern with concrete bars, and content, wildcard and variables bar. The alphabet is deduced from the content.
+	 * \brief Creates a new instance of the pattern with concrete bars, content, wildcard, and variables bar. The alphabet is deduced from the content.
 	 *
 	 * \param bars the initial bar set
-	 * \param variables bar the initial variables bar
+	 * \param variablesBar the initial variables bar
 	 * \param subtreeWildcard the wildcard symbol
 	 * \param data the initial pattern in linear representation
 	 */
diff --git a/alib2data/src/tree/ranked/PrefixRankedBarTree.h b/alib2data/src/tree/ranked/PrefixRankedBarTree.h
index 4997fdf9f2cfb3c9b0878d402d52cf3aeeffbb1d..bc93fd2a3db1ddad5c8e1701292a5d3a3e10f5ac 100644
--- a/alib2data/src/tree/ranked/PrefixRankedBarTree.h
+++ b/alib2data/src/tree/ranked/PrefixRankedBarTree.h
@@ -56,7 +56,7 @@ class BarSymbols;
 
 /**
  * \brief
- * Tree structure represented as linear sequece as result of preorder traversal with additional bar symbols. The representation is so called ranked, therefore it consists of ranked symbols (bars are ranked as well). The rank of the ranked symbol need to compatible with unsigned integer.
+ * Tree structure represented as linear sequece as result of preorder traversal with additional bar symbols. The representation is so called ranked, therefore it consists of ranked symbols (bars are ranked as well). The rank of the ranked symbol needs to be compatible with unsigned integer.
  *
  * The bars represent end mark of all subtrees in the notation.
  *
diff --git a/alib2data/src/tree/ranked/PrefixRankedNonlinearPattern.h b/alib2data/src/tree/ranked/PrefixRankedNonlinearPattern.h
index e71bd2bbd972d3e83aa969c14b1ff7b1138ccf33..ff00e0b6ddde92ab0b270e19f816400be0ebf8b4 100644
--- a/alib2data/src/tree/ranked/PrefixRankedNonlinearPattern.h
+++ b/alib2data/src/tree/ranked/PrefixRankedNonlinearPattern.h
@@ -1,6 +1,22 @@
 /*
  * PrefixRankedNonlinearPattern.h
  *
+ * This file is part of Algorithms library toolkit.
+ * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz)
+
+ * Algorithms library toolkit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * Algorithms library toolkit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with Algorithms library toolkit.  If not, see <http://www.gnu.org/licenses/>.
+ *
  *  Created on: Jul 20, 2016
  *      Author: Jan Travnicek
  */
@@ -40,94 +56,263 @@ class SubtreeWildcard;
 class NonlinearAlphabet;
 
 /**
- * Represents regular expression parsed from the XML. Regular expression is stored
- * as a tree of LinearStringElement.
+ * \brief
+ * Nonlinear tree pattern represented as linear sequece as result of preorder traversal. The representation is so called ranked, therefore it consists of ranked symbols. The rank of the ranked symbol needs to be compatible with unsigned integer. Additionally the pattern contains a special wildcard symbol representing any subtree and nonlinear variables each to represent same subtree (in the particular occurrence in a tree).
+ *
+ * \details
+ * T = (A, C, W \in ( A \minus B ), V \in ( A \minus B) ),
+ * A (Alphabet) = finite set of ranked symbols,
+ * C (Content) = linear representation of the pattern content
+ * W (Wildcard) = special symbol representing any subtree
+ * V (Variables) = finite set of special symbols each representing same subtree
+ *
+ * \tparam SymbolType used for the symbol part of the ranked symbol
+ * \tparam RankType used for the rank part of the ranked symbol
  */
 template < class SymbolType, class RankType >
 class PrefixRankedNonlinearPattern final : public TreeBase, public core::Components < PrefixRankedNonlinearPattern < SymbolType, RankType >, ext::set < common::ranked_symbol < SymbolType, RankType > >, component::Set, std::tuple < GeneralAlphabet, NonlinearAlphabet >, common::ranked_symbol < SymbolType, RankType >, component::Value, SubtreeWildcard > {
+	/**
+	 * Linear representation of the pattern content.
+	 */
 	ext::vector < common::ranked_symbol < SymbolType, RankType > > m_Data;
 
+	/**
+	 * Checker of validity of the representation of the ettern
+	 *
+	 * \throws TreeException when new pattern representation is not valid
+	 */
+	void arityChecksum ( const ext::vector < common::ranked_symbol < SymbolType, RankType > > & data );
+
 public:
+	/**
+	 * \brief Creates a new instance of the pattern with concrete alphabet, content, wildcard, and nonlinear variables.
+	 *
+	 * \param subtreeWildcard the wildcard symbol
+	 * \param nonlinearVariables the set of nonlinear variables
+	 * \param alphabet the initial alphabet of the pattern
+	 * \param data the initial pattern in linear representation
+	 */
 	explicit PrefixRankedNonlinearPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, ext::set < common::ranked_symbol < SymbolType, RankType > > nonlinearVariables, ext::set < common::ranked_symbol < SymbolType, RankType > > alphabet, ext::vector < common::ranked_symbol < SymbolType, RankType > > data );
+
+	/**
+	 * \brief Creates a new instance of the pattern with concrete content, wildcard, and nonlinear variables. The alphabet is deduced from the content.
+	 *
+	 * \param subtreeWildcard the wildcard symbol
+	 * \param nonlinearVariables the set of nonlinear variables
+	 * \param data the initial pattern in linear representation
+	 */
 	explicit PrefixRankedNonlinearPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, ext::set < common::ranked_symbol < SymbolType, RankType > > nonlinearVariables, ext::vector < common::ranked_symbol < SymbolType, RankType > > data );
+
+	/**
+	 * \brief Creates a new instance of the pattern with concrete content and wildcard. The alphabet is deduced from the content. Nonlinear variables are defaultly constructed to empty set.
+	 *
+	 * \param subtreeWildcard the wildcard symbol
+	 * \param data the initial pattern in linear representation
+	 */
 	explicit PrefixRankedNonlinearPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, ext::vector < common::ranked_symbol < SymbolType, RankType > > data );
+
+	/**
+	 * \brief Creates a new instance of the pattern based on the PrefixRankedTree. The linear representation is copied from tree. Alphabet as well. subtree wildcard is defaultly constructed and nonlinear variables are defaultly constructed to empty set.
+	 *
+	 * \param tree representation of a tree.
+	 */
 	explicit PrefixRankedNonlinearPattern ( const PrefixRankedTree < SymbolType, RankType > & tree );
+
+	/**
+	 * \brief Creates a new instance of the pattern based on the PrefixRankedPattern. The linear representation is copied from tree. Subtree wildcard and alphabet as well. Nonlinear variables are defaultly constructed to empty set.
+	 *
+	 * \param tree representation of a tree.
+	 */
 	explicit PrefixRankedNonlinearPattern ( const PrefixRankedPattern < SymbolType, RankType > & tree );
+
+	/**
+	 * \brief Creates a new instance of the pattern based on the RankedTree. The linear representation is constructed by preorder traversal on the tree parameter. The subtree wildcard is defaultly constructed and nonlinear variables are defaultly constructed to empty set.
+	 *
+	 * \param tree representation of a tree.
+	 */
 	explicit PrefixRankedNonlinearPattern ( const RankedTree < SymbolType, RankType > & tree );
+
+	/**
+	 * \brief Creates a new instance of the pattern based on the RankedPattern. The linear representation is constructed by preorder traversal on the tree parameter. The subtree wildcard is provided by the pattern parameter and nonlinear variables are defaultly constructed to empty set.
+	 *
+	 * \param tree representation of a pattern.
+	 */
 	explicit PrefixRankedNonlinearPattern ( const RankedPattern < SymbolType, RankType > & tree );
+
+	/**
+	 * \brief Creates a new instance of the pattern based on the RankedNonlinearPattern. The linear representation is constructed by preorder traversal on the tree parameter. The subtree wildcard and nonlinear variables are provided by the pattern parameter.
+	 *
+	 * \param tree representation of a pattern.
+	 */
 	explicit PrefixRankedNonlinearPattern ( const RankedNonlinearPattern < SymbolType, RankType > & tree );
 
-	virtual TreeBase * clone ( ) const;
-	virtual TreeBase * plunder ( ) &&;
+	/**
+	 * @copydoc tree::TreeBase::clone()
+	 */
+	virtual TreeBase * clone ( ) const override;
 
+	/**
+	 * @copydoc tree::TreeBase::plunder()
+	 */
+	virtual TreeBase * plunder ( ) && override;
+
+	/**
+	 * Getter of the alphabet.
+	 *
+	 * \returns the alphabet of the pattern
+	 */
 	const ext::set < common::ranked_symbol < SymbolType, RankType > > & getAlphabet ( ) const & {
 		return this->template accessComponent < GeneralAlphabet > ( ).get ( );
 	}
 
+	/**
+	 * Getter of the alphabet.
+	 *
+	 * \returns the alphabet of the pattern
+	 */
 	ext::set < common::ranked_symbol < SymbolType, RankType > > && getAlphabet ( ) && {
 		return std::move ( this->template accessComponent < GeneralAlphabet > ( ).get ( ) );
 	}
 
+	/**
+	 * Adder of an alphabet symbols.
+	 *
+	 * \param symbols the new symbols to be added to the alphabet
+	 */
 	void extendAlphabet ( const ext::set < common::ranked_symbol < SymbolType, RankType > > & symbols ) {
 		this->template accessComponent < GeneralAlphabet > ( ).add ( symbols );
 	}
 
+	/**
+	 * Getter of the wildcard symbol.
+	 *
+	 * \returns the wildcard symbol of the pattern
+	 */
 	const common::ranked_symbol < SymbolType, RankType > & getSubtreeWildcard ( ) const & {
 		return this->template accessComponent < SubtreeWildcard > ( ).get ( );
 	}
 
+	/**
+	 * Getter of the wildcard symbol.
+	 *
+	 * \returns the wildcard symbol of the pattern
+	 */
 	common::ranked_symbol < SymbolType, RankType > && getSubtreeWildcard ( ) && {
 		return std::move ( this->template accessComponent < SubtreeWildcard > ( ).get ( ) );
 	}
 
+	/**
+	 * Getter of the nonlinear variables.
+	 *
+	 * \returns the nonlinear variables of the pattern
+	 */
 	const ext::set < common::ranked_symbol < SymbolType, RankType > > & getNonlinearVariables ( ) const & {
 		return this->template accessComponent < NonlinearAlphabet > ( ).get ( );
 	}
 
+	/**
+	 * Getter of the nonlinear variables.
+	 *
+	 * \returns the nonlinear variables of the pattern
+	 */
 	ext::set < common::ranked_symbol < SymbolType, RankType > > && getNonlinearVariables ( ) && {
 		return std::move ( this->template accessComponent < NonlinearAlphabet > ( ).get ( ) );
 	}
 
 	/**
-	 * @return List of symbols forming tree (const version).
+	 * Getter of the pattern representation.
+	 *
+	 * \return List of symbols forming the linear representation of the pattern.
 	 */
 	const ext::vector < common::ranked_symbol < SymbolType, RankType > > & getContent ( ) const &;
 
+	/**
+	 * Getter of the pattern representation.
+	 *
+	 * \return List of symbols forming the linear representation of the pattern.
+	 */
 	ext::vector < common::ranked_symbol < SymbolType, RankType > > && getContent ( ) &&;
 
+	/**
+	 * Setter of the representation of the pattern.
+	 *
+	 * \throws TreeException when new pattern representation is not valid or when symbol of the representation are not present in the alphabet
+	 *
+	 * \param data new List of symbols forming the representation of the pattern.
+	 */
 	void setContent ( ext::vector < common::ranked_symbol < SymbolType, RankType > > data );
 
-	void arityChecksum ( const ext::vector < common::ranked_symbol < SymbolType, RankType > > & data );
-
 	/**
-	 * @return true if tree is an empty word (vector length is 0)
+	 * @return true if pattern is an empty word (vector length is 0). The method is present to allow compatibility with strings. Tree is never empty in this datatype.
 	 */
 	bool isEmpty ( ) const;
 
-	virtual int compare ( const ObjectBase & other ) const {
+	/**
+	 * @copydoc alib::CommonBase<ObjectBase>::compare ( const ObjectBase & )
+	 */
+	virtual int compare ( const ObjectBase & other ) const override {
 		if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other );
 
 		return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) );
 	}
 
-	virtual int compare ( const PrefixRankedNonlinearPattern & other ) const;
+	/**
+	 * The actual compare method
+	 *
+	 * \param other the other instance
+	 *
+	 * \returns the actual relation between two by type same pattern instances
+	 */
+	int compare ( const PrefixRankedNonlinearPattern & other ) const;
 
-	virtual void operator >>( std::ostream & out ) const;
+	/**
+	 * @copydoc alib::CommonBase<ObjectBase>::operator >> ( std::ostream & )
+	 */
+	virtual void operator >>( std::ostream & out ) const override;
 
-	virtual explicit operator std::string ( ) const;
+	/**
+	 * @copydoc alib::CommonBase<ObjectBase>::operator std::string ( )
+	 */
+	virtual explicit operator std::string ( ) const override;
 
+	/**
+	 * \brief The XML tag name of class.
+	 *
+	 * \details Intentionaly a static member function to be safe in the initialisation before the main function starts.
+	 *
+	 * \returns string representing the XML tag name of the class
+	 */
 	static const std::string & getXmlTagName ( ) {
 		static std::string xmlTagName = "PrefixRankedNonlinearPattern";
 
 		return xmlTagName;
 	}
 
+	/**
+	 * Parsing from a sequence of xml tokens helper.
+	 *
+	 * \params input the iterator to sequence of xml tokens to parse from
+	 *
+	 * \returns the new instance of the pattern
+	 */
 	static PrefixRankedNonlinearPattern parse ( ext::deque < sax::Token >::iterator & input );
 
+	/**
+	 * Composing to a sequence of xml tokens helper.
+	 *
+	 * \param out the sink for new xml tokens representing the pattern
+	 * \param pattern the pattern to compose
+	 */
 	static void compose ( ext::deque < sax::Token > & out, const PrefixRankedNonlinearPattern & pattern );
 
-	virtual object::ObjectBase * inc ( ) &&;
+	/**
+	 * @copydoc alib::ObjectBase::inc()
+	 */
+	virtual object::ObjectBase * inc ( ) && override;
 
+	/**
+	 * Type of normalized pattern.
+	 */
 	typedef PrefixRankedNonlinearPattern < > normalized_type;
 };
 
@@ -288,50 +473,130 @@ object::ObjectBase* PrefixRankedNonlinearPattern < SymbolType, RankType >::inc()
 
 namespace core {
 
+/**
+ * Helper class specifying constraints for the pattern's internal alphabet component.
+ *
+ * \tparam SymbolType used for the symbol part of the ranked symbols of the alphabet of the pattern.
+ * \tparam RankType used for the rank part of the ranked symbols of the alphabet of the pattern.
+ */
 template < class SymbolType, class RankType >
 class SetConstraint< tree::PrefixRankedNonlinearPattern < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, tree::GeneralAlphabet > {
 public:
+	/**
+	 * Returns true if the symbol is still used in the pattern.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \returns true if the symbol is used, false othervise
+	 */
 	static bool used ( const tree::PrefixRankedNonlinearPattern < SymbolType, RankType > & pattern, const common::ranked_symbol < SymbolType, RankType > & symbol ) {
 		const ext::vector < common::ranked_symbol < SymbolType, RankType > > & m_content = pattern.getContent ( );
 
 		return std::find ( m_content.begin ( ), m_content.end ( ), symbol ) != m_content.end ( ) || pattern.template accessComponent < tree::SubtreeWildcard > ( ).get ( ) == symbol;
 	}
 
+	/**
+	 * Returns true as all symbols are possibly available to be in an alphabet.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \returns true
+	 */
 	static bool available ( const tree::PrefixRankedNonlinearPattern < SymbolType, RankType > &, const common::ranked_symbol < SymbolType, RankType > & ) {
 		return true;
 	}
 
+	/**
+	 * All symbols are valid as symbols of an alphabet.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 */
 	static void valid ( const tree::PrefixRankedNonlinearPattern < SymbolType, RankType > &, const common::ranked_symbol < SymbolType, RankType > & ) {
 	}
 };
 
+/**
+ * Helper class specifying constraints for the pattern's internal nonlinear variables component.
+ *
+ * \tparam SymbolType used for the symbol part of the ranked symbols of the alphabet of the pattern.
+ * \tparam RankType used for the rank part of the ranked symbols of the alphabet of the pattern.
+ */
 template < class SymbolType, class RankType >
 class SetConstraint< tree::PrefixRankedNonlinearPattern < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, tree::NonlinearAlphabet > {
 public:
+	/**
+	 * Returns false. Nonlinear symbol is only a mark that the pattern itself does require further. //FIXME it is however followed by variables bar... Maybe get rid of the variables bar?
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \returns true if the symbol is used, false othervise
+	 */
 	static bool used ( const tree::PrefixRankedNonlinearPattern < SymbolType, RankType > &, const common::ranked_symbol < SymbolType, RankType > & ) {
 		return false;
 	}
 
+	/**
+	 * Determines whether the symbol is available in the pattern's alphabet.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \returns true
+	 */
 	static bool available ( const tree::PrefixRankedNonlinearPattern < SymbolType, RankType > & pattern, const common::ranked_symbol < SymbolType, RankType > & symbol ) {
 		return pattern.template accessComponent < tree::GeneralAlphabet > ( ).get ( ).count ( symbol );
 	}
 
+	/**
+	 * Nonlinear variable needs to have zero arity and needs to be different from subtree wildcard.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \throws TreeException if the symbol does not have zero arity
+	 */
 	static void valid ( const tree::PrefixRankedNonlinearPattern < SymbolType, RankType > & pattern, const common::ranked_symbol < SymbolType, RankType > & symbol) {
 		if ( ( unsigned ) symbol.getRank ( ) != 0 )
-			throw tree::TreeException ( "SubtreeWildcard symbol has nonzero arity" );
+			throw tree::TreeException ( "Nonlinear variable has nonzero arity" );
 
 		if ( pattern.template accessComponent < tree::SubtreeWildcard > ( ).get ( ) == symbol )
 			throw tree::TreeException ( "Symbol " + ext::to_string ( symbol ) + "cannot be set as nonlinear variable since it is already subtree wildcard" );
 	}
 };
 
+/**
+ * Helper class specifying constraints for the pattern's internal subtree wildcard element.
+ *
+ * \tparam SymbolType used for the symbol part of the ranked symbols of the alphabet of the pattern.
+ * \tparam RankType used for the rank part of the ranked symbols of the alphabet of the pattern.
+ */
 template < class SymbolType, class RankType >
 class ElementConstraint< tree::PrefixRankedNonlinearPattern < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, tree::SubtreeWildcard > {
 public:
+	/**
+	 * Determines whether the symbol is available in the pattern's alphabet.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \returns true if the symbol is already in the alphabet of the pattern
+	 */
 	static bool available ( const tree::PrefixRankedNonlinearPattern < SymbolType, RankType > & pattern, const common::ranked_symbol < SymbolType, RankType > & symbol ) {
 		return pattern.template accessComponent < tree::GeneralAlphabet > ( ).get ( ).count ( symbol );
 	}
 
+	/**
+	 * Subtree wildcard needs to have zero arity and it needs to be different from any nonlinear variable of the tree.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \throws TreeException if the symbol does not have zero arity
+	 */
 	static void valid ( const tree::PrefixRankedNonlinearPattern < SymbolType, RankType > & pattern, const common::ranked_symbol < SymbolType, RankType > & symbol) {
 		if ( ( unsigned ) symbol.getRank ( ) != 0 )
 			throw tree::TreeException ( "SubtreeWildcard symbol has nonzero arity" );
@@ -341,6 +606,11 @@ public:
 	}
 };
 
+/**
+ * Helper for normalisation of types specified by templates used as internal datatypes of symbols.
+ *
+ * \returns new instance of the tree with default template parameters or unmodified instance if the template parameters were already default ones
+ */
 template < class SymbolType, class RankType >
 struct normalize < tree::PrefixRankedNonlinearPattern < SymbolType, RankType >, typename std::enable_if < ! std::is_same < tree::PrefixRankedNonlinearPattern < SymbolType, RankType >, tree::PrefixRankedNonlinearPattern < > >::value >::type > {
 	static tree::PrefixRankedNonlinearPattern < > eval ( tree::PrefixRankedNonlinearPattern < SymbolType, RankType > && value ) {
diff --git a/alib2data/src/tree/ranked/PrefixRankedPattern.h b/alib2data/src/tree/ranked/PrefixRankedPattern.h
index a990fc400738bac0efc17df48dfcda45bed5a52f..92631f965c091c7cf494fc27b3d90b2620702159 100644
--- a/alib2data/src/tree/ranked/PrefixRankedPattern.h
+++ b/alib2data/src/tree/ranked/PrefixRankedPattern.h
@@ -1,6 +1,22 @@
 /*
  * PrefixRankedPattern.h
  *
+ * This file is part of Algorithms library toolkit.
+ * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz)
+
+ * Algorithms library toolkit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * Algorithms library toolkit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with Algorithms library toolkit.  If not, see <http://www.gnu.org/licenses/>.
+ *
  *  Created on: Nov 23, 2013
  *      Author: Jan Travnicek
  */
@@ -39,82 +55,213 @@ class GeneralAlphabet;
 class SubtreeWildcard;
 
 /**
- * Represents regular expression parsed from the XML. Regular expression is stored
- * as a tree of LinearStringElement.
+ * \brief
+ * Tree pattern represented as linear sequece as result of preorder traversal. The representation is so called ranked, therefore it consists of ranked symbols. The rank of the ranked symbol needs to be compatible with unsigned integer. Additionally the pattern contains a special wildcard symbol representing any subtree.
+ *
+ * \details
+ * T = (A, C, W \in ( A \minus B ) ),
+ * A (Alphabet) = finite set of ranked symbols,
+ * C (Content) = linear representation of the pattern content
+ * W (Wildcard) = special symbol representing any subtree
+ *
+ * \tparam SymbolType used for the symbol part of the ranked symbol
+ * \tparam RankType used for the rank part of the ranked symbol
  */
 template < class SymbolType, class RankType >
 class PrefixRankedPattern final : public TreeBase, public core::Components < PrefixRankedPattern < SymbolType, RankType >, ext::set < common::ranked_symbol < SymbolType, RankType > >, component::Set, GeneralAlphabet, common::ranked_symbol < SymbolType, RankType >, component::Value, SubtreeWildcard > {
+	/**
+	 * Linear representation of the pattern content.
+	 */
 	ext::vector < common::ranked_symbol < SymbolType, RankType > > m_Data;
 
+	/**
+	 * Checker of validity of the representation of the ettern
+	 *
+	 * \throws TreeException when new pattern representation is not valid
+	 */
+	void arityChecksum ( const ext::vector < common::ranked_symbol < SymbolType, RankType > > & data );
+
 public:
+	/**
+	 * \brief Creates a new instance of the pattern with concrete alphabet, content, and wildcard.
+	 *
+	 * \param subtreeWildcard the wildcard symbol
+	 * \param alphabet the initial alphabet of the pattern
+	 * \param data the initial pattern in linear representation
+	 */
 	explicit PrefixRankedPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, ext::set < common::ranked_symbol < SymbolType, RankType > > alphabet, ext::vector < common::ranked_symbol < SymbolType, RankType > > data );
+
+	/**
+	 * \brief Creates a new instance of the pattern with concrete content and wildcard. The alphabet is deduced from the content.
+	 *
+	 * \param subtreeWildcard the wildcard symbol
+	 * \param data the initial pattern in linear representation
+	 */
 	explicit PrefixRankedPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, ext::vector < common::ranked_symbol < SymbolType, RankType > > data );
+
+	/**
+	 * \brief Creates a new instance of the pattern based on the PrefixRankedTree. The linear representation is copied from tree. Alphabet as well. Subtree wildcard are defaultly constructed.
+	 *
+	 * \param tree representation of a tree.
+	 */
 	explicit PrefixRankedPattern ( const PrefixRankedTree < SymbolType, RankType > & tree );
+
+	/**
+	 * \brief Creates a new instance of the pattern based on the RankedPattern. The linear representation is constructed by preorder traversal on the tree parameter.
+	 *
+	 * \param tree representation of a pattern.
+	 */
 	explicit PrefixRankedPattern ( const RankedPattern < SymbolType, RankType > & tree );
 
-	virtual TreeBase * clone ( ) const;
-	virtual TreeBase * plunder ( ) &&;
+	/**
+	 * @copydoc tree::TreeBase::clone()
+	 */
+	virtual TreeBase * clone ( ) const override;
+
+	/**
+	 * @copydoc tree::TreeBase::plunder()
+	 */
+	virtual TreeBase * plunder ( ) && override;
 
+	/**
+	 * Getter of the alphabet.
+	 *
+	 * \returns the alphabet of the pattern
+	 */
 	const ext::set < common::ranked_symbol < SymbolType, RankType > > & getAlphabet ( ) const & {
 		return this->template accessComponent < GeneralAlphabet > ( ).get ( );
 	}
 
+	/**
+	 * Getter of the alphabet.
+	 *
+	 * \returns the alphabet of the pattern
+	 */
 	ext::set < common::ranked_symbol < SymbolType, RankType > > && getAlphabet ( ) && {
 		return std::move ( this->template accessComponent < GeneralAlphabet > ( ).get ( ) );
 	}
 
+	/**
+	 * Adder of an alphabet symbols.
+	 *
+	 * \param symbols the new symbols to be added to the alphabet
+	 */
 	void extendAlphabet ( const ext::set < common::ranked_symbol < SymbolType, RankType > > & symbols ) {
 		this->template accessComponent < GeneralAlphabet > ( ).add ( symbols );
 	}
 
+	/**
+	 * Getter of the wildcard symbol.
+	 *
+	 * \returns the wildcard symbol of the pattern
+	 */
 	const common::ranked_symbol < SymbolType, RankType > & getSubtreeWildcard ( ) const & {
 		return this->template accessComponent < SubtreeWildcard > ( ).get ( );
 	}
 
+	/**
+	 * Getter of the wildcard symbol.
+	 *
+	 * \returns the wildcard symbol of the pattern
+	 */
 	common::ranked_symbol < SymbolType, RankType > && getSubtreeWildcard ( ) && {
 		return std::move ( this->template accessComponent < SubtreeWildcard > ( ).get ( ) );
 	}
 
 	/**
-	 * @return List of symbols forming tree (const version).
+	 * Getter of the pattern representation.
+	 *
+	 * \return List of symbols forming the linear representation of the pattern.
 	 */
 	const ext::vector < common::ranked_symbol < SymbolType, RankType > > & getContent ( ) const &;
 
+	/**
+	 * Getter of the pattern representation.
+	 *
+	 * \return List of symbols forming the linear representation of the pattern.
+	 */
 	ext::vector < common::ranked_symbol < SymbolType, RankType > > && getContent ( ) &&;
 
+	/**
+	 * Setter of the representation of the pattern.
+	 *
+	 * \throws TreeException when new pattern representation is not valid or when symbol of the representation are not present in the alphabet
+	 *
+	 * \param data new List of symbols forming the representation of the pattern.
+	 */
 	void setContent ( ext::vector < common::ranked_symbol < SymbolType, RankType > > data );
 
-	void arityChecksum ( const ext::vector < common::ranked_symbol < SymbolType, RankType > > & data );
-
 	/**
-	 * @return true if tree is an empty word (vector length is 0)
+	 * @return true if pattern is an empty word (vector length is 0). The method is present to allow compatibility with strings. Tree is never empty in this datatype.
 	 */
 	bool isEmpty ( ) const;
 
-	virtual int compare ( const ObjectBase & other ) const {
+	/**
+	 * @copydoc alib::CommonBase<ObjectBase>::compare ( const ObjectBase & )
+	 */
+	virtual int compare ( const ObjectBase & other ) const override {
 		if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other );
 
 		return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) );
 	}
 
-	virtual int compare ( const PrefixRankedPattern & other ) const;
+	/**
+	 * The actual compare method
+	 *
+	 * \param other the other instance
+	 *
+	 * \returns the actual relation between two by type same pattern instances
+	 */
+	int compare ( const PrefixRankedPattern & other ) const;
 
-	virtual void operator >>( std::ostream & out ) const;
+	/**
+	 * @copydoc alib::CommonBase<ObjectBase>::operator >> ( std::ostream & )
+	 */
+	virtual void operator >>( std::ostream & out ) const override;
 
-	virtual explicit operator std::string ( ) const;
+	/**
+	 * @copydoc alib::CommonBase<ObjectBase>::operator std::string ( )
+	 */
+	virtual explicit operator std::string ( ) const override;
 
+	/**
+	 * \brief The XML tag name of class.
+	 *
+	 * \details Intentionaly a static member function to be safe in the initialisation before the main function starts.
+	 *
+	 * \returns string representing the XML tag name of the class
+	 */
 	static const std::string & getXmlTagName() {
 		static std::string xmlTagName = "PrefixRankedPattern";
 
 		return xmlTagName;
 	}
 
+	/**
+	 * Parsing from a sequence of xml tokens helper.
+	 *
+	 * \params input the iterator to sequence of xml tokens to parse from
+	 *
+	 * \returns the new instance of the pattern
+	 */
 	static PrefixRankedPattern parse ( ext::deque < sax::Token >::iterator & input );
 
+	/**
+	 * Composing to a sequence of xml tokens helper.
+	 *
+	 * \param out the sink for new xml tokens representing the pattern
+	 * \param pattern the pattern to compose
+	 */
 	static void compose ( ext::deque < sax::Token > & out, const PrefixRankedPattern & pattern );
 
-	virtual object::ObjectBase * inc ( ) &&;
+	/**
+	 * @copydoc alib::ObjectBase::inc()
+	 */
+	virtual object::ObjectBase * inc ( ) && override;
 
+	/**
+	 * Type of normalized pattern.
+	 */
 	typedef PrefixRankedPattern < > normalized_type;
 };
 
@@ -254,36 +401,91 @@ object::ObjectBase* PrefixRankedPattern < SymbolType, RankType >::inc() && {
 
 namespace core {
 
+/**
+ * Helper class specifying constraints for the pattern's internal alphabet component.
+ *
+ * \tparam SymbolType used for the symbol part of the ranked symbols of the alphabet of the pattern.
+ * \tparam RankType used for the rank part of the ranked symbols of the alphabet of the pattern.
+ */
 template < class SymbolType, class RankType >
 class SetConstraint< tree::PrefixRankedPattern < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, tree::GeneralAlphabet > {
 public:
+	/**
+	 * Returns true if the symbol is still used in the pattern.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \returns true if the symbol is used, false othervise
+	 */
 	static bool used ( const tree::PrefixRankedPattern < SymbolType, RankType > & pattern, const common::ranked_symbol < SymbolType, RankType > & symbol ) {
 		const ext::vector < common::ranked_symbol < SymbolType, RankType > > & content = pattern.getContent ( );
 
 		return std::find ( content.begin ( ), content.end ( ), symbol ) != content.end ( ) || pattern.template accessComponent < tree::SubtreeWildcard > ( ).get ( ) == symbol;
 	}
 
+	/**
+	 * Returns true as all symbols are possibly available to be in an alphabet.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \returns true
+	 */
 	static bool available ( const tree::PrefixRankedPattern < SymbolType, RankType > &, const common::ranked_symbol < SymbolType, RankType > & ) {
 		return true;
 	}
 
+	/**
+	 * All symbols are valid as symbols of an alphabet.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 */
 	static void valid ( const tree::PrefixRankedPattern < SymbolType, RankType > &, const common::ranked_symbol < SymbolType, RankType > & ) {
 	}
 };
 
+/**
+ * Helper class specifying constraints for the pattern's internal subtree wildcard element.
+ *
+ * \tparam SymbolType used for the symbol part of the ranked symbols of the alphabet of the pattern.
+ * \tparam RankType used for the rank part of the ranked symbols of the alphabet of the pattern.
+ */
 template < class SymbolType, class RankType >
 class ElementConstraint< tree::PrefixRankedPattern < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, tree::SubtreeWildcard > {
 public:
+	/**
+	 * Determines whether the symbol is available in the pattern's alphabet.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \returns true if the symbol is already in the alphabet of the pattern
+	 */
 	static bool available ( const tree::PrefixRankedPattern < SymbolType, RankType > & pattern, const common::ranked_symbol < SymbolType, RankType > & symbol ) {
 		return pattern.template accessComponent < tree::GeneralAlphabet > ( ).get ( ).count ( symbol );
 	}
 
+	/**
+	 * Subtree wildcard needs to have zero arity.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \throws TreeException if the symbol does not have zero arity
+	 */
 	static void valid ( const tree::PrefixRankedPattern < SymbolType, RankType > &, const common::ranked_symbol < SymbolType, RankType > & symbol) {
 		if( ( unsigned ) symbol.getRank() != 0 )
 			throw tree::TreeException ( "SubtreeWildcard symbol has nonzero arity" );
 	}
 };
 
+/**
+ * Helper for normalisation of types specified by templates used as internal datatypes of symbols.
+ *
+ * \returns new instance of the tree with default template parameters or unmodified instance if the template parameters were already default ones
+ */
 template < class SymbolType, class RankType >
 struct normalize < tree::PrefixRankedPattern < SymbolType, RankType >, typename std::enable_if < ! std::is_same < tree::PrefixRankedPattern < SymbolType, RankType >, tree::PrefixRankedPattern < > >::value >::type > {
 	static tree::PrefixRankedPattern < > eval ( tree::PrefixRankedPattern < SymbolType, RankType > && value ) {
diff --git a/alib2data/src/tree/ranked/PrefixRankedTree.h b/alib2data/src/tree/ranked/PrefixRankedTree.h
index 6b56e2f9db84980ec41eccb6c341eaee97f12414..fecc3c8247fc662f433b64c0c9f45c06aeef828e 100644
--- a/alib2data/src/tree/ranked/PrefixRankedTree.h
+++ b/alib2data/src/tree/ranked/PrefixRankedTree.h
@@ -52,7 +52,7 @@ class GeneralAlphabet;
 
 /**
  * \brief
- * Tree structure represented as linear sequece as result of preorder traversal. The representation is so called ranked, therefore it consists of ranked symbols. The rank of the ranked symbol need to compatible with unsigned integer.
+ * Tree structure represented as linear sequece as result of preorder traversal. The representation is so called ranked, therefore it consists of ranked symbols. The rank of the ranked symbol needs to be compatible with unsigned integer.
 
  * \details
  * T = (A, C),
diff --git a/alib2data/src/tree/ranked/RankedNonlinearPattern.h b/alib2data/src/tree/ranked/RankedNonlinearPattern.h
index ddc071af12605768b7f33127f9381c7f36a73c88..f28ffa027cf0c39f2a9791ed8b090d96ec9b52b4 100644
--- a/alib2data/src/tree/ranked/RankedNonlinearPattern.h
+++ b/alib2data/src/tree/ranked/RankedNonlinearPattern.h
@@ -1,6 +1,22 @@
 /*
  * RankedNonlinearPattern.h
  *
+ * This file is part of Algorithms library toolkit.
+ * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz)
+
+ * Algorithms library toolkit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * Algorithms library toolkit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with Algorithms library toolkit.  If not, see <http://www.gnu.org/licenses/>.
+ *
  *  Created on: Nov 23, 2013
  *      Author: Jan Travnicek
  */
@@ -38,106 +54,249 @@ class SubtreeWildcard;
 class NonlinearAlphabet;
 
 /**
- * Represents regular expression parsed from the XML. Regular expression is stored
- * as a pattern of RegExpElement.
+ * \brief
+ * Nonlinear tree pattern represented in its natural representation. The representation is so called ranked, therefore it consists of ranked symbols. The rank of the ranked symbol needs to be compatible with unsigned integer. Additionally the pattern contains a special wildcard symbol representing any subtree and nonlinear variables each to represent same subtree (in the particular occurrence in a tree).
+ *
+ * \details
+ * T = (A, C, W \in ( A \minus B ), V \in ( A \minus B) ),
+ * A (Alphabet) = finite set of ranked symbols,
+ * C (Content) = pattern in its natural representation
+ * W (Wildcard) = special symbol representing any subtree
+ * V (Variables) = finite set of special symbols each representing same subtree
+ *
+ * \tparam SymbolType used for the symbol part of the ranked symbol
+ * \tparam RankType used for the rank part of the ranked symbol
  */
 template < class SymbolType, class RankType >
 class RankedNonlinearPattern final : public TreeBase, public core::Components < RankedNonlinearPattern < SymbolType, RankType >, ext::set < common::ranked_symbol < SymbolType, RankType > >, component::Set, std::tuple < GeneralAlphabet, NonlinearAlphabet >, common::ranked_symbol < SymbolType, RankType >, component::Value, SubtreeWildcard > {
+	/**
+	 * Natural representation of the pattern content.
+	 */
 	ext::tree < common::ranked_symbol < SymbolType, RankType > > m_content;
 
+	/**
+	 * Checks that symbols of the pattern are present in the alphabet.
+	 *
+	 * \throws TreeException when some symbols of the pattern representation are not present in the alphabet
+	 *
+	 * \param data the pattern in its natural representation
+	 */
 	void checkAlphabet ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & pattern ) const;
 
+	/**
+	 * Checks that the rank of each symbol of a pattern node corresponds to the number of child nodes of that same node.
+	 *
+	 * \throws TreeException when some nodes of a pattern have different number of children than the rank of their label states
+	 *
+	 * \param data the pattern in its natural representation
+	 */
 	void checkArities ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & data ) const;
 
 public:
 	/**
-	 * @copydoc ext::tree < common::ranked_symbol < SymbolType, RankType > >::clone() const
+	 * \brief Creates a new instance of the pattern with concrete alphabet, content, wildcard, and nonlinear variables.
+	 *
+	 * \param subtreeWildcard the wildcard symbol
+	 * \param nonlinearVariables the set of nonlinear variables
+	 * \param alphabet the initial alphabet of the pattern
+	 * \param pattern the initial content in it's natural representation
 	 */
-	virtual TreeBase * clone ( ) const;
+	explicit RankedNonlinearPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, ext::set < common::ranked_symbol < SymbolType, RankType > > nonlinearVariables, ext::set < common::ranked_symbol < SymbolType, RankType > > alphabet, ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern );
 
 	/**
-	 * @copydoc ext::tree < common::ranked_symbol < SymbolType, RankType > >::plunder() const
+	 * \brief Creates a new instance of the pattern with concrete content, wildcard, and nonlinear variables. The alphabet is deduced from the content.
+	 *
+	 * \param subtreeWildcard the wildcard symbol
+	 * \param nonlinearVariables the set of nonlinear variables
+	 * \param pattern the initial content in it's natural representation
 	 */
-	virtual TreeBase * plunder ( ) &&;
-
-	explicit RankedNonlinearPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, ext::set < common::ranked_symbol < SymbolType, RankType > > nonlinearVariables, ext::set < common::ranked_symbol < SymbolType, RankType > > alphabet, ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern );
 	explicit RankedNonlinearPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, ext::set < common::ranked_symbol < SymbolType, RankType > > nonlinearVariables, ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern );
+
+	/**
+	 * \brief Creates a new instance of the pattern with concrete content and wildcard. The alphabet is deduced from the content. Nonlinear variables are defaultly constructed to empty set.
+	 *
+	 * \param subtreeWildcard the wildcard symbol
+	 * \param pattern the initial content in it's natural representation
+	 */
 	explicit RankedNonlinearPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern );
+
+	/**
+	 * \brief Creates a new instance of the pattern based on UnrankedNonlinearPattern, the alphabet is created from the content of the UnrankedNonlinearPattern. The alphabet is created since ranks cannot be deduced.
+	 *
+	 * \param other the pattern represented as UnrankedNonlinearPattern
+	 */
 	explicit RankedNonlinearPattern ( const UnrankedNonlinearPattern < SymbolType > & other );
 
+	/**
+	 * @copydoc ext::tree < common::ranked_symbol < SymbolType, RankType > >::clone() const
+	 */
+	virtual TreeBase * clone ( ) const override;
+
+	/**
+	 * @copydoc ext::tree < common::ranked_symbol < SymbolType, RankType > >::plunder() const
+	 */
+	virtual TreeBase * plunder ( ) && override;
+
+	/**
+	 * Getter of the alphabet.
+	 *
+	 * \returns the alphabet of the pattern
+	 */
 	const ext::set < common::ranked_symbol < SymbolType, RankType > > & getAlphabet ( ) const & {
 		return this->template accessComponent < GeneralAlphabet > ( ).get ( );
 	}
 
+	/**
+	 * Getter of the alphabet.
+	 *
+	 * \returns the alphabet of the pattern
+	 */
 	ext::set < common::ranked_symbol < SymbolType, RankType > > && getAlphabet ( ) && {
 		return std::move ( this->template accessComponent < GeneralAlphabet > ( ).get ( ) );
 	}
 
+	/**
+	 * Adder of an alphabet symbols.
+	 *
+	 * \param symbols the new symbols to be added to the alphabet
+	 */
 	void extendAlphabet ( const ext::set < common::ranked_symbol < SymbolType, RankType > > & symbols ) {
 		this->template accessComponent < GeneralAlphabet > ( ).add ( symbols );
 	}
 
+	/**
+	 * Getter of the wildcard symbol.
+	 *
+	 * \returns the wildcard symbol of the pattern
+	 */
 	const common::ranked_symbol < SymbolType, RankType > & getSubtreeWildcard ( ) const & {
 		return this->template accessComponent < SubtreeWildcard > ( ).get ( );
 	}
 
+	/**
+	 * Getter of the wildcard symbol.
+	 *
+	 * \returns the wildcard symbol of the pattern
+	 */
 	common::ranked_symbol < SymbolType, RankType > && getSubtreeWildcard ( ) && {
 		return std::move ( this->template accessComponent < SubtreeWildcard > ( ).get ( ) );
 	}
 
+	/**
+	 * Getter of the nonlinear variables.
+	 *
+	 * \returns the nonlinear variables of the pattern
+	 */
 	const ext::set < common::ranked_symbol < SymbolType, RankType > > & getNonlinearVariables ( ) const & {
 		return this->template accessComponent < NonlinearAlphabet > ( ).get ( );
 	}
 
+	/**
+	 * Getter of the nonlinear variables.
+	 *
+	 * \returns the nonlinear variables of the pattern
+	 */
 	ext::set < common::ranked_symbol < SymbolType, RankType > > && getNonlinearVariables ( ) && {
 		return std::move ( this->template accessComponent < NonlinearAlphabet > ( ).get ( ) );
 	}
 
 	/**
-	 * @return Root node of the regular expression pattern
+	 * Getter of the pattern representation.
+	 *
+	 * \return the natural representation of the pattern.
 	 */
 	const ext::tree < common::ranked_symbol < SymbolType, RankType > > & getContent ( ) const &;
 
+	/**
+	 * Getter of the pattern representation.
+	 *
+	 * \return the natural representation of the pattern.
+	 */
 	ext::tree < common::ranked_symbol < SymbolType, RankType > > && getContent ( ) &&;
 
 	/**
-	 * Sets the root node of the regular expression pattern
-	 * @param pattern root node to set
+	 * Setter of the representation of the pattern.
+	 *
+	 * \throws TreeException in same situations as checkAlphabet and checkArities
+	 *
+	 * \param pattern new representation of the pattern.
 	 */
 	void setTree ( ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern );
 
 	/**
-	 * Prints XML representation of the pattern to the output stream.
-	 * @param out output stream to which print the pattern
-	 * @param pattern pattern to print
+	 * @copydoc alib::CommonBase<ObjectBase>::compare ( const ObjectBase & )
 	 */
-	virtual void operator >>( std::ostream & out ) const;
-
-	virtual int compare ( const ObjectBase & other ) const {
+	virtual int compare ( const ObjectBase & other ) const override {
 		if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other );
 
 		return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) );
 	}
 
-	virtual int compare ( const RankedNonlinearPattern & other ) const;
+	/**
+	 * The actual compare method
+	 *
+	 * \param other the other instance
+	 *
+	 * \returns the actual relation between two by type same pattern instances
+	 */
+	int compare ( const RankedNonlinearPattern & other ) const;
 
-	void nicePrint ( std::ostream & os ) const;
+	/**
+	 * @copydoc alib::CommonBase<ObjectBase>::operator >> ( std::ostream & )
+	 */
+	virtual void operator >>( std::ostream & out ) const override;
 
-	virtual explicit operator std::string ( ) const;
+	/**
+	 * @copydoc alib::CommonBase<ObjectBase>::operator std::string ( )
+	 */
+	virtual explicit operator std::string ( ) const override;
 
+	/**
+	 * \brief The XML tag name of class.
+	 *
+	 * \details Intentionaly a static member function to be safe in the initialisation before the main function starts.
+	 *
+	 * \returns string representing the XML tag name of the class
+	 */
 	static const std::string & getXmlTagName() {
 		static std::string xmlTagName = "RankedNonlinearPattern";
 
 		return xmlTagName;
 	}
 
+	/**
+	 * Parsing from a sequence of xml tokens helper.
+	 *
+	 * \params input the iterator to sequence of xml tokens to parse from
+	 *
+	 * \returns the new instance of the pattern
+	 */
 	static RankedNonlinearPattern parse ( ext::deque < sax::Token >::iterator & input );
 
+	/**
+	 * Composing to a sequence of xml tokens helper.
+	 *
+	 * \param out the sink for new xml tokens representing the pattern
+	 * \param pattern the pattern to compose
+	 */
 	static void compose ( ext::deque < sax::Token > & out, const RankedNonlinearPattern & pattern );
 
-	virtual object::ObjectBase * inc ( ) &&;
+	/**
+	 * @copydoc alib::ObjectBase::inc()
+	 */
+	virtual object::ObjectBase * inc ( ) && override;
 
+	/**
+	 * Type of normalized pattern.
+	 */
 	typedef RankedNonlinearPattern < > normalized_type;
+
+	/**
+	 * Nice printer of the tree natural representation
+	 *
+	 * \param os the output stream to print to
+	 */
+	void nicePrint ( std::ostream & os ) const;
 };
 
 } /* namespace tree */
@@ -270,49 +429,129 @@ object::ObjectBase* RankedNonlinearPattern < SymbolType, RankType >::inc() && {
 
 namespace core {
 
+/**
+ * Helper class specifying constraints for the pattern's internal alphabet component.
+ *
+ * \tparam SymbolType used for the symbol part of the ranked symbols of the alphabet of the pattern.
+ * \tparam RankType used for the rank part of the ranked symbols of the alphabet of the pattern.
+ */
 template < class SymbolType, class RankType >
 class SetConstraint< tree::RankedNonlinearPattern < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, tree::GeneralAlphabet > {
 public:
+	/**
+	 * Returns true if the symbol is still used in the pattern.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \returns true if the symbol is used, false othervise
+	 */
 	static bool used ( const tree::RankedNonlinearPattern < SymbolType, RankType > & pattern, const common::ranked_symbol < SymbolType, RankType > & symbol ) {
 		const ext::tree < common::ranked_symbol < SymbolType, RankType > > & m_content = pattern.getContent ( );
 		return std::find(m_content.prefix_begin(), m_content.prefix_end(), symbol) != m_content.prefix_end() || pattern.template accessComponent < tree::SubtreeWildcard > ( ).get ( ) == symbol || pattern.template accessComponent < tree::NonlinearAlphabet > ( ).get ( ).count ( symbol );
 	}
 
+	/**
+	 * Returns true as all symbols are possibly available to be in an alphabet.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \returns true
+	 */
 	static bool available ( const tree::RankedNonlinearPattern < SymbolType, RankType > &, const common::ranked_symbol < SymbolType, RankType > & ) {
 		return true;
 	}
 
+	/**
+	 * All symbols are valid as symbols of an alphabet.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 */
 	static void valid ( const tree::RankedNonlinearPattern < SymbolType, RankType > &, const common::ranked_symbol < SymbolType, RankType > & ) {
 	}
 };
 
+/**
+ * Helper class specifying constraints for the pattern's internal nonlinear variables component.
+ *
+ * \tparam SymbolType used for the symbol part of the ranked symbols of the alphabet of the pattern.
+ * \tparam RankType used for the rank part of the ranked symbols of the alphabet of the pattern.
+ */
 template < class SymbolType, class RankType >
 class SetConstraint< tree::RankedNonlinearPattern < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, tree::NonlinearAlphabet > {
 public:
+	/**
+	 * Returns false. Nonlinear symbol is only a mark that the pattern itself does require further. //FIXME it is however followed by variables bar... Maybe get rid of the variables bar?
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \returns true if the symbol is used, false othervise
+	 */
 	static bool used ( const tree::RankedNonlinearPattern < SymbolType, RankType > &, const common::ranked_symbol < SymbolType, RankType > & ) {
 		return false;
 	}
 
+	/**
+	 * Determines whether the symbol is available in the pattern's alphabet.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \returns true
+	 */
 	static bool available ( const tree::RankedNonlinearPattern < SymbolType, RankType > & pattern, const common::ranked_symbol < SymbolType, RankType > & symbol ) {
 		return pattern.template accessComponent < tree::GeneralAlphabet > ( ).get ( ).count ( symbol );
 }
 
+	/**
+	 * Nonlinear variable needs to have zero arity and needs to be different from subtree wildcard.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \throws TreeException if the symbol does not have zero arity
+	 */
 	static void valid ( const tree::RankedNonlinearPattern < SymbolType, RankType > & pattern, const common::ranked_symbol < SymbolType, RankType > & symbol) {
 		if( ( unsigned ) symbol.getRank() != 0 )
-			throw tree::TreeException ( "SubtreeWildcard symbol has nonzero arity" );
+			throw tree::TreeException ( "Nonlinear variable symbol has nonzero arity" );
 
 		if ( pattern.template accessComponent < tree::SubtreeWildcard > ( ).get ( ) == symbol )
 			throw tree::TreeException ( "Symbol " + ext::to_string ( symbol ) + "cannot be set as nonlinear variable since it is already subtree wildcard" );
 	}
 };
 
+/**
+ * Helper class specifying constraints for the pattern's internal subtree wildcard element.
+ *
+ * \tparam SymbolType used for the symbol part of the ranked symbols of the alphabet of the pattern.
+ * \tparam RankType used for the rank part of the ranked symbols of the alphabet of the pattern.
+ */
 template < class SymbolType, class RankType >
 class ElementConstraint< tree::RankedNonlinearPattern < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, tree::SubtreeWildcard > {
 public:
+	/**
+	 * Determines whether the symbol is available in the pattern's alphabet.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \returns true if the symbol is already in the alphabet of the pattern
+	 */
 	static bool available ( const tree::RankedNonlinearPattern < SymbolType, RankType > & pattern, const common::ranked_symbol < SymbolType, RankType > & symbol ) {
 		return pattern.template accessComponent < tree::GeneralAlphabet > ( ).get ( ).count ( symbol );
 	}
 
+	/**
+	 * Subtree wildcard needs to have zero arity and it needs to be different from any nonlinear variable of the tree.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \throws TreeException if the symbol does not have zero arity
+	 */
 	static void valid ( const tree::RankedNonlinearPattern < SymbolType, RankType > & pattern, const common::ranked_symbol < SymbolType, RankType > & symbol) {
 		if( ( unsigned ) symbol.getRank() != 0 )
 			throw tree::TreeException ( "SubtreeWildcard symbol has nonzero arity" );
@@ -322,6 +561,11 @@ public:
 	}
 };
 
+/**
+ * Helper for normalisation of types specified by templates used as internal datatypes of symbols.
+ *
+ * \returns new instance of the tree with default template parameters or unmodified instance if the template parameters were already default ones
+ */
 template < class SymbolType, class RankType >
 struct normalize < tree::RankedNonlinearPattern < SymbolType, RankType >, typename std::enable_if < ! std::is_same < tree::RankedNonlinearPattern < SymbolType, RankType >, tree::RankedNonlinearPattern < > >::value >::type > {
 	static tree::RankedNonlinearPattern < > eval ( tree::RankedNonlinearPattern < SymbolType, RankType > && value ) {
diff --git a/alib2data/src/tree/ranked/RankedPattern.h b/alib2data/src/tree/ranked/RankedPattern.h
index ac0e30a2618140c44cb3012bc46112dc26c34e3c..16e40df6a67e850a7cd5f19b5a3cb4f5dfb04221 100644
--- a/alib2data/src/tree/ranked/RankedPattern.h
+++ b/alib2data/src/tree/ranked/RankedPattern.h
@@ -1,6 +1,22 @@
 /*
  * RankedPattern.h
  *
+ * This file is part of Algorithms library toolkit.
+ * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz)
+
+ * Algorithms library toolkit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * Algorithms library toolkit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with Algorithms library toolkit.  If not, see <http://www.gnu.org/licenses/>.
+ *
  *  Created on: Nov 23, 2013
  *      Author: Jan Travnicek
  */
@@ -37,97 +53,220 @@ class GeneralAlphabet;
 class SubtreeWildcard;
 
 /**
- * Represents regular expression parsed from the XML. Regular expression is stored
- * as a pattern of RegExpElement.
+ * \brief
+ * Tree pattern represented in its natural representation. The representation is so called ranked, therefore it consists of ranked symbols. The rank of the ranked symbol needs to be compatible with unsigned integer. Additionally the pattern contains a special wildcard symbol representing any subtree.
+ *
+ * \details
+ * T = (A, C, W \in ( A \minus B ) ),
+ * A (Alphabet) = finite set of ranked symbols,
+ * C (Content) = pattern in its natural representation
+ * W (Wildcard) = special symbol representing any subtree
+ *
+ * \tparam SymbolType used for the symbol part of the ranked symbol
+ * \tparam RankType used for the rank part of the ranked symbol
  */
 template < class SymbolType, class RankType >
 class RankedPattern final : public TreeBase, public core::Components < RankedPattern < SymbolType, RankType >, ext::set < common::ranked_symbol < SymbolType, RankType > >, component::Set, GeneralAlphabet, common::ranked_symbol < SymbolType, RankType >, component::Value, SubtreeWildcard > {
+	/**
+	 * Natural representation of the pattern content.
+	 */
 	ext::tree < common::ranked_symbol < SymbolType, RankType > > m_content;
 
+	/**
+	 * Checks that symbols of the pattern are present in the alphabet.
+	 *
+	 * \throws TreeException when some symbols of the pattern representation are not present in the alphabet
+	 *
+	 * \param data the pattern in its natural representation
+	 */
 	void checkAlphabet ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & pattern ) const;
 
+	/**
+	 * Checks that the rank of each symbol of a pattern node corresponds to the number of child nodes of that same node.
+	 *
+	 * \throws TreeException when some nodes of a pattern have different number of children than the rank of their label states
+	 *
+	 * \param data the pattern in its natural representation
+	 */
 	void checkArities ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & data ) const;
 
 public:
 	/**
-	 * @copydoc ext::tree < common::ranked_symbol < SymbolType, RankType > >::clone() const
+	 * \brief Creates a new instance of the pattern with concrete alphabet, content, and wildcard.
+	 *
+	 * \param subtreeWildcard the wildcard symbol
+	 * \param alphabet the initial alphabet of the pattern
+	 * \param pattern the initial content in it's natural representation
 	 */
-	virtual TreeBase * clone ( ) const;
+	explicit RankedPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, ext::set < common::ranked_symbol < SymbolType, RankType > > alphabet, ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern );
 
 	/**
-	 * @copydoc ext::tree < common::ranked_symbol < SymbolType, RankType > >::plunder() const
+	 * \brief Creates a new instance of the pattern with concrete content and wildcard. The alphabet is deduced from the content.
+	 *
+	 * \param subtreeWildcard the wildcard symbol
+	 * \param pattern the initial content in it's natural representation
 	 */
-	virtual TreeBase * plunder ( ) &&;
-
-	explicit RankedPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, ext::set < common::ranked_symbol < SymbolType, RankType > > alphabet, ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern );
 	explicit RankedPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern );
+
+	/**
+	 * \brief Creates a new instance of the pattern based on UnrankedPattern, the alphabet is created from the content of the UnrankedPattern. The alphabet is created since ranks cannot be deduced.
+	 *
+	 * \param other the pattern represented as UnrankedNonlinearPattern
+	 */
 	explicit RankedPattern ( const UnrankedPattern < SymbolType > & other );
 
+	/**
+	 * @copydoc ext::tree < common::ranked_symbol < SymbolType, RankType > >::clone() const
+	 */
+	virtual TreeBase * clone ( ) const override;
+
+	/**
+	 * @copydoc ext::tree < common::ranked_symbol < SymbolType, RankType > >::plunder() const
+	 */
+	virtual TreeBase * plunder ( ) && override;
+
+	/**
+	 * Getter of the alphabet.
+	 *
+	 * \returns the alphabet of the pattern
+	 */
 	const ext::set < common::ranked_symbol < SymbolType, RankType > > & getAlphabet ( ) const & {
 		return this->template accessComponent < GeneralAlphabet > ( ).get ( );
 	}
 
+	/**
+	 * Getter of the alphabet.
+	 *
+	 * \returns the alphabet of the pattern
+	 */
 	ext::set < common::ranked_symbol < SymbolType, RankType > > && getAlphabet ( ) && {
 		return std::move ( this->template accessComponent < GeneralAlphabet > ( ).get ( ) );
 	}
 
+	/**
+	 * Adder of an alphabet symbols.
+	 *
+	 * \param symbols the new symbols to be added to the alphabet
+	 */
 	void extendAlphabet ( const ext::set < common::ranked_symbol < SymbolType, RankType > > & symbols ) {
 		this->template accessComponent < GeneralAlphabet > ( ).add ( symbols );
 	}
 
+	/**
+	 * Getter of the wildcard symbol.
+	 *
+	 * \returns the wildcard symbol of the pattern
+	 */
 	const common::ranked_symbol < SymbolType, RankType > & getSubtreeWildcard ( ) const & {
 		return this->template accessComponent < SubtreeWildcard > ( ).get ( );
 	}
 
+	/**
+	 * Getter of the wildcard symbol.
+	 *
+	 * \returns the wildcard symbol of the pattern
+	 */
 	common::ranked_symbol < SymbolType, RankType > && getSubtreeWildcard ( ) && {
 		return std::move ( this->template accessComponent < SubtreeWildcard > ( ).get ( ) );
 	}
 
 	/**
-	 * @return Root node of the regular expression pattern
+	 * Getter of the pattern representation.
+	 *
+	 * \return the natural representation of the pattern.
 	 */
 	const ext::tree < common::ranked_symbol < SymbolType, RankType > > & getContent ( ) const &;
 
+	/**
+	 * Getter of the pattern representation.
+	 *
+	 * \return the natural representation of the pattern.
+	 */
 	ext::tree < common::ranked_symbol < SymbolType, RankType > > && getContent ( ) &&;
 
 	/**
-	 * Sets the root node of the regular expression pattern
-	 * @param pattern root node to set
+	 * Setter of the representation of the pattern.
+	 *
+	 * \throws TreeException in same situations as checkAlphabet and checkArities
+	 *
+	 * \param pattern new representation of the pattern.
 	 */
 	void setTree ( ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern );
 
 	/**
-	 * Prints XML representation of the pattern to the output stream.
-	 * @param out output stream to which print the pattern
-	 * @param pattern pattern to print
+	 * @copydoc alib::CommonBase<ObjectBase>::compare ( const ObjectBase & )
 	 */
-	virtual void operator >>( std::ostream & out ) const;
-
-	virtual int compare ( const ObjectBase & other ) const {
+	virtual int compare ( const ObjectBase & other ) const override {
 		if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other );
 
 		return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) );
 	}
 
-	virtual int compare ( const RankedPattern & other ) const;
+	/**
+	 * The actual compare method
+	 *
+	 * \param other the other instance
+	 *
+	 * \returns the actual relation between two by type same pattern instances
+	 */
+	int compare ( const RankedPattern & other ) const;
 
-	void nicePrint ( std::ostream & os ) const;
+	/**
+	 * @copydoc alib::CommonBase<ObjectBase>::operator >> ( std::ostream & )
+	 */
+	virtual void operator >>( std::ostream & out ) const override;
 
-	virtual explicit operator std::string ( ) const;
+	/**
+	 * @copydoc alib::CommonBase<ObjectBase>::operator std::string ( )
+	 */
+	virtual explicit operator std::string ( ) const override;
 
+	/**
+	 * \brief The XML tag name of class.
+	 *
+	 * \details Intentionaly a static member function to be safe in the initialisation before the main function starts.
+	 *
+	 * \returns string representing the XML tag name of the class
+	 */
 	static const std::string & getXmlTagName() {
 		static std::string xmlTagName = "RankedPattern";
 
 		return xmlTagName;
 	}
 
+	/**
+	 * Parsing from a sequence of xml tokens helper.
+	 *
+	 * \params input the iterator to sequence of xml tokens to parse from
+	 *
+	 * \returns the new instance of the pattern
+	 */
 	static RankedPattern parse ( ext::deque < sax::Token >::iterator & input );
 
+	/**
+	 * Composing to a sequence of xml tokens helper.
+	 *
+	 * \param out the sink for new xml tokens representing the pattern
+	 * \param pattern the pattern to compose
+	 */
 	static void compose ( ext::deque < sax::Token > & out, const RankedPattern & pattern );
 
-	virtual object::ObjectBase * inc ( ) &&;
+	/**
+	 * @copydoc alib::ObjectBase::inc()
+	 */
+	virtual object::ObjectBase * inc ( ) && override;
 
+	/**
+	 * Type of normalized pattern.
+	 */
 	typedef RankedPattern < > normalized_type;
+
+	/**
+	 * Nice printer of the tree natural representation
+	 *
+	 * \param os the output stream to print to
+	 */
+	void nicePrint ( std::ostream & os ) const;
 };
 
 } /* namespace tree */
@@ -254,35 +393,90 @@ object::ObjectBase* RankedPattern < SymbolType, RankType >::inc() && {
 
 namespace core {
 
+/**
+ * Helper class specifying constraints for the pattern's internal alphabet component.
+ *
+ * \tparam SymbolType used for the symbol part of the ranked symbols of the alphabet of the pattern.
+ * \tparam RankType used for the rank part of the ranked symbols of the alphabet of the pattern.
+ */
 template < class SymbolType, class RankType >
 class SetConstraint< tree::RankedPattern < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, tree::GeneralAlphabet > {
 public:
+	/**
+	 * Returns true if the symbol is still used in the pattern.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \returns true if the symbol is used, false othervise
+	 */
 	static bool used ( const tree::RankedPattern < SymbolType, RankType > & pattern, const common::ranked_symbol < SymbolType, RankType > & symbol ) {
 		const ext::tree < common::ranked_symbol < SymbolType, RankType > > & m_content = pattern.getContent ( );
 		return std::find(m_content.prefix_begin(), m_content.prefix_end(), symbol) != m_content.prefix_end() || pattern.template accessComponent < tree::SubtreeWildcard > ( ).get ( ) == symbol;
 	}
 
+	/**
+	 * Returns true as all symbols are possibly available to be in an alphabet.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \returns true
+	 */
 	static bool available ( const tree::RankedPattern < SymbolType, RankType > &, const common::ranked_symbol < SymbolType, RankType > & ) {
 		return true;
 	}
 
+	/**
+	 * All symbols are valid as symbols of an alphabet.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 */
 	static void valid ( const tree::RankedPattern < SymbolType, RankType > &, const common::ranked_symbol < SymbolType, RankType > & ) {
 	}
 };
 
+/**
+ * Helper class specifying constraints for the pattern's internal subtree wildcard element.
+ *
+ * \tparam SymbolType used for the symbol part of the ranked symbols of the alphabet of the pattern.
+ * \tparam RankType used for the rank part of the ranked symbols of the alphabet of the pattern.
+ */
 template < class SymbolType, class RankType >
 class ElementConstraint< tree::RankedPattern < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, tree::SubtreeWildcard > {
 public:
+	/**
+	 * Determines whether the symbol is available in the pattern's alphabet.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \returns true if the symbol is already in the alphabet of the pattern
+	 */
 	static bool available ( const tree::RankedPattern < SymbolType, RankType > & pattern, const common::ranked_symbol < SymbolType, RankType > & symbol ) {
 		return pattern.template accessComponent < tree::GeneralAlphabet > ( ).get ( ).count ( symbol );
 	}
 
+	/**
+	 * Subtree wildcard needs to have zero arity and it needs to be different from any nonlinear variable of the tree.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \throws TreeException if the symbol does not have zero arity
+	 */
 	static void valid ( const tree::RankedPattern < SymbolType, RankType > &, const common::ranked_symbol < SymbolType, RankType > & symbol) {
 		if( ( unsigned ) symbol.getRank() != 0 )
 			throw tree::TreeException ( "SubtreeWildcard symbol has nonzero arity" );
 	}
 };
 
+/**
+ * Helper for normalisation of types specified by templates used as internal datatypes of symbols.
+ *
+ * \returns new instance of the tree with default template parameters or unmodified instance if the template parameters were already default ones
+ */
 template < class SymbolType, class RankType >
 struct normalize < tree::RankedPattern < SymbolType, RankType >, typename std::enable_if < ! std::is_same < tree::RankedPattern < SymbolType, RankType >, tree::RankedPattern < > >::value >::type > {
 	static tree::RankedPattern < > eval ( tree::RankedPattern < SymbolType, RankType > && value ) {
diff --git a/alib2data/src/tree/ranked/RankedTree.h b/alib2data/src/tree/ranked/RankedTree.h
index a69824d488543f31bef8e060b2446ec3b34eee84..4e5fbb2b5d3261370220e1bdd1c416b4f4600752 100644
--- a/alib2data/src/tree/ranked/RankedTree.h
+++ b/alib2data/src/tree/ranked/RankedTree.h
@@ -54,7 +54,7 @@ class GeneralAlphabet;
 
 /**
  * \brief
- * Tree structure represented in its natural representation. The representation is so called ranked, therefore it consists of ranked symbols. The rank of the ranked symbol need to compatible with unsigned integer.
+ * Tree structure represented in its natural representation. The representation is so called ranked, therefore it consists of ranked symbols. The rank of the ranked symbol needs to be compatible with unsigned integer.
 
  * \details
  * T = (A, C),
@@ -106,7 +106,7 @@ public:
 	explicit RankedTree ( ext::tree < common::ranked_symbol < SymbolType, RankType > > tree );
 
 	/**
-	 * \brief Creates a new instance of the tree based on UnrankedTree, the alphabet is created from the content of the UnrankedTree and alphabet is created since ranks cannot be deduced.
+	 * \brief Creates a new instance of the tree based on UnrankedTree, the alphabet is created from the content of the UnrankedTree. The alphabet is created since ranks cannot be deduced.
 	 *
 	 * \param other the tree represented as UnrankedTree
 	 */
@@ -197,13 +197,6 @@ public:
 	 */
 	int compare ( const RankedTree & other ) const;
 
-	/**
-	 * Hierarchical printer of the tree.
-	 *
-	 * \param os the output stream destination of the print
-	 */
-	void nicePrint ( std::ostream & os ) const;
-
 	/**
 	 * @copydoc alib::CommonBase<ObjectBase>::operator >> ( std::ostream & )
 	 */
@@ -253,6 +246,13 @@ public:
 	 * Type of normalized tree.
 	 */
 	typedef RankedTree < > normalized_type;
+
+	/**
+	 * Hierarchical printer of the tree.
+	 *
+	 * \param os the output stream destination of the print
+	 */
+	void nicePrint ( std::ostream & os ) const;
 };
 
 } /* namespace tree */