diff --git a/alib2data/src/tree/ranked/PrefixRankedBarNonlinearPattern.h b/alib2data/src/tree/ranked/PrefixRankedBarNonlinearPattern.h
index dd8f58edc50fa49b1c444195dbfa76f44cb485c0..8111b288b645a15c584db8231b46fc7d3a117c86 100644
--- a/alib2data/src/tree/ranked/PrefixRankedBarNonlinearPattern.h
+++ b/alib2data/src/tree/ranked/PrefixRankedBarNonlinearPattern.h
@@ -1,6 +1,22 @@
 /*
  * PrefixRankedBarNonlinearPattern.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
  */
@@ -44,117 +60,345 @@ class VariablesBarSymbol;
 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 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.
+ *
+ * The bars represent end mark of all subpatterns in the notation.
+ *
+ * \details
+ * T = (A, B \subset A, C, W \in ( A \minus B ), V \in ( A \minus B), Wb \in B ),
+ * A (Alphabet) = finite set of ranked symbols,
+ * B (Bars) = finite set of ranked symbols representing bars,
+ * 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
+ * Wb (VariablesBar) = special bar symbol to match wildcard
+ *
+ * \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 PrefixRankedBarNonlinearPattern final : public TreeBase, public core::Components < PrefixRankedBarNonlinearPattern < SymbolType, RankType >, ext::set < common::ranked_symbol < SymbolType, RankType > >, component::Set, std::tuple < GeneralAlphabet, NonlinearAlphabet, BarSymbols >, common::ranked_symbol < SymbolType, RankType >, component::Value, std::tuple < SubtreeWildcard, VariablesBarSymbol > > {
+	/**
+	 * 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, bars, content, wildcard, nonlinear variables, and variables bar.
+	 *
+	 * \param bars the initial bar set
+	 * \param variables bar the initial variables bar
+	 * \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 PrefixRankedBarNonlinearPattern ( ext::set < common::ranked_symbol < SymbolType, RankType > > bars, common::ranked_symbol < SymbolType, RankType > variablesBar, 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 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 subtreeWildcard the wildcard symbol
+	 * \param nonlinearVariables the set of nonlinear variables
+	 * \param data the initial pattern in linear representation
+	 */
 	explicit PrefixRankedBarNonlinearPattern ( ext::set < common::ranked_symbol < SymbolType, RankType > > bars, common::ranked_symbol < SymbolType, RankType > variablesBar, 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 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 subtreeWildcard the wildcard symbol
+	 * \param data the initial pattern in linear representation
+	 */
 	explicit PrefixRankedBarNonlinearPattern ( ext::set < common::ranked_symbol < SymbolType, RankType > > bars, common::ranked_symbol < SymbolType, RankType > variablesBar, 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 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 tree representation of a tree.
+	 */
 	explicit PrefixRankedBarNonlinearPattern ( SymbolType barBase, common::ranked_symbol < SymbolType, RankType > variablesBar, const RankedTree < SymbolType, RankType > & tree );
+
+	/**
+	 * \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 tree representation of a pattern.
+	 */
 	explicit PrefixRankedBarNonlinearPattern ( SymbolType barBase, common::ranked_symbol < SymbolType, RankType > variablesBar, const RankedPattern < SymbolType, RankType > & tree );
+
+	/**
+	 * \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 tree representation of a pattern.
+	 */
 	explicit PrefixRankedBarNonlinearPattern ( SymbolType barBase, common::ranked_symbol < SymbolType, RankType > variablesBar, const RankedNonlinearPattern < SymbolType, RankType > & tree );
+
+	/**
+	 * \brief Creates a new instance of the pattern based on the PrefixRankedBarTree. The linear representation is copied from tree. Bars and alphabet as well. Variables bar, subtree wildcard are defaultly constructed and nonlinear variables are defaultly constructed to empty set.
+	 *
+	 * \param tree representation of a tree.
+	 */
 	explicit PrefixRankedBarNonlinearPattern ( const PrefixRankedBarTree < SymbolType, RankType > & tree );
+
+	/**
+	 * \brief Creates a new instance of the pattern based on the PrefixRankedBarPattern. The linear representation is copied from tree. Subtree wildcard, variables bar, bars, and alphabet as well. Nonlinear variables are defaultly constructed to empty set.
+	 *
+	 * \param tree representation of a tree.
+	 */
 	explicit PrefixRankedBarNonlinearPattern ( const PrefixRankedBarPattern < SymbolType, RankType > & tree );
+
+	/**
+	 * \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. Bars are computed to match symbols used in the representation from RankedPattern. Subtree wildcard and variables bar are defaultly constructed. Nonlinear variables are defaultly constructed to empty set.
+	 *
+	 * \param tree RankedTree representation of a tree.
+	 */
 	explicit PrefixRankedBarNonlinearPattern ( const RankedTree < SymbolType, RankType > & tree );
+
+	/**
+	 * \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. Bars are computed to match symbols used in the representation from RankedPattern. Subtree wildcard is copied from the pattern. Variables bar is defaultly constructed. Nonlinear variables are defaultly constructed to empty set.
+	 *
+	 * \param tree RankedTree representation of a tree.
+	 */
 	explicit PrefixRankedBarNonlinearPattern ( const RankedPattern < SymbolType, RankType > & tree );
+
+	/**
+	 * \brief Creates a new instance of the pattern based on the NonlinearRankedPattern. The linear representation is constructed (including bars) by preorder traversal on the tree parameter. Bars are computed to match symbols used in the representation from RankedPattern. Subtree wildcard and nonlinear variables are copied from the pattern. Variables bar is defaultly constructed.
+	 *
+	 * \param tree RankedTree representation of a tree.
+	 */
 	explicit PrefixRankedBarNonlinearPattern ( 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 bar set.
+	 *
+	 * \returns the bar set of the pattern
+	 */
 	const ext::set < common::ranked_symbol < SymbolType, RankType > > & getBars ( ) const & {
 		return this->template accessComponent < BarSymbols > ( ).get ( );
 	}
 
+	/**
+	 * Getter of the bar set.
+	 *
+	 * \returns the bar set of the pattern
+	 */
 	ext::set < common::ranked_symbol < SymbolType, RankType > > && getBars ( ) && {
 		return std::move ( this->template accessComponent < BarSymbols > ( ).get ( ) );
 	}
 
+	/**
+	 * Adder of symbols to a bar set.
+	 *
+	 * \param symbols the new symbols to be added to the bar set
+	 */
 	void extendBars ( const ext::set < common::ranked_symbol < SymbolType, RankType > > & bars ) {
 		this->template accessComponent < BarSymbols > ( ).add ( bars );
 	}
 
+	/**
+	 * 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 ( ) );
 	}
 
+	/**
+	 * Getter of the variables bar.
+	 *
+	 * \returns the variables bar of the pattern
+	 */
 	const common::ranked_symbol < SymbolType, RankType > & getVariablesBar ( ) const & {
 		return this->template accessComponent < VariablesBarSymbol > ( ).get ( );
 	}
 
+	/**
+	 * Getter of the variables bar.
+	 *
+	 * \returns the variables bar of the pattern
+	 */
 	common::ranked_symbol < SymbolType, RankType > && getVariablesBar ( ) && {
 		return std::move ( this->template accessComponent < VariablesBarSymbol > ( ).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 PrefixRankedBarNonlinearPattern & 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 PrefixRankedBarNonlinearPattern & 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 = "PrefixRankedBarNonlinearPattern";
 
 		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 PrefixRankedBarNonlinearPattern 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 PrefixRankedBarNonlinearPattern & pattern );
 
-	virtual object::ObjectBase * inc ( ) &&;
+	/**
+	 * @copydoc alib::ObjectBase::inc()
+	 */
+	virtual object::ObjectBase * inc ( ) && override;
 
+	/**
+	 * Type of normalized pattern.
+	 */
 	typedef PrefixRankedBarNonlinearPattern < > normalized_type;
 };
 
@@ -349,67 +593,175 @@ object::ObjectBase* PrefixRankedBarNonlinearPattern < SymbolType, RankType >::in
 
 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::PrefixRankedBarNonlinearPattern < 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::PrefixRankedBarNonlinearPattern < 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::VariablesBarSymbol > ( ).get ( ) == symbol || pattern.template accessComponent < tree::BarSymbols > ( ).get ( ).count ( symbol ) || 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::PrefixRankedBarNonlinearPattern < 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::PrefixRankedBarNonlinearPattern < SymbolType, RankType > &, const common::ranked_symbol < SymbolType, RankType > & ) {
 	}
 };
 
+/**
+ * Helper class specifying constraints for the pattern's internal bar set 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::PrefixRankedBarNonlinearPattern < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, tree::BarSymbols > {
 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::PrefixRankedBarNonlinearPattern < 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::VariablesBarSymbol > ( ).get ( ) == symbol;
 	}
 
+	/**
+	 * 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::PrefixRankedBarNonlinearPattern < SymbolType, RankType > & pattern, const common::ranked_symbol < SymbolType, RankType > & symbol ) {
 		return pattern.template accessComponent < tree::GeneralAlphabet > ( ).get ( ).count ( symbol );
 	}
 
+	/**
+	 * All symbols are valid as a bar symbol of the pattern.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 */
 	static void valid ( const tree::PrefixRankedBarNonlinearPattern < 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::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?
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \returns true if the symbol is used, false othervise
+	 */
 	static bool used ( const tree::PrefixRankedBarNonlinearPattern < SymbolType, RankType > &, const common::ranked_symbol < SymbolType, RankType > & ) {
 		return false;
 	}
 
+	/**
+	 * Returns true as all symbols are possibly available to be in a nonlinear alphabet.
+	 *
+	 * \param pattern the tested pattern
+	 * \param symbol the tested symbol
+	 *
+	 * \returns true
+	 */
 	static bool available ( const tree::PrefixRankedBarNonlinearPattern < 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::PrefixRankedBarNonlinearPattern < 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::PrefixRankedBarNonlinearPattern < 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::PrefixRankedBarNonlinearPattern < 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::PrefixRankedBarNonlinearPattern < SymbolType, RankType > & pattern, const common::ranked_symbol < SymbolType, RankType > & symbol) {
 		if ( ( unsigned ) symbol.getRank ( ) != 0 )
 			throw tree::TreeException ( "SubtreeWildcard symbol has nonzero arity" );
@@ -419,19 +771,46 @@ public:
 	}
 };
 
+/**
+ * Helper class specifying constraints for the pattern's internal variables bar 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::PrefixRankedBarNonlinearPattern < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, tree::VariablesBarSymbol > {
 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::PrefixRankedBarNonlinearPattern < SymbolType, RankType > & pattern, const common::ranked_symbol < SymbolType, RankType > & symbol ) {
 		return pattern.template accessComponent < tree::BarSymbols > ( ).get ( ).count ( symbol );
 	}
 
+	/**
+	 * Variables bar 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::PrefixRankedBarNonlinearPattern < SymbolType, RankType > &, const common::ranked_symbol < SymbolType, RankType > & symbol) {
 		if ( ( unsigned ) symbol.getRank ( ) != 0 )
 			throw tree::TreeException ( "VariablesBarSymbol 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::PrefixRankedBarNonlinearPattern < SymbolType, RankType >, typename std::enable_if < ! std::is_same < tree::PrefixRankedBarNonlinearPattern < SymbolType, RankType >, tree::PrefixRankedBarNonlinearPattern < > >::value >::type > {
 	static tree::PrefixRankedBarNonlinearPattern < > eval ( tree::PrefixRankedBarNonlinearPattern < SymbolType, RankType > && value ) {
diff --git a/alib2data/src/tree/ranked/PrefixRankedBarPattern.h b/alib2data/src/tree/ranked/PrefixRankedBarPattern.h
index 73f2f4a86047463154f1c68e20091812cac50e2f..03aaffea61ea81ed1f4d194a374a3d144960451d 100644
--- a/alib2data/src/tree/ranked/PrefixRankedBarPattern.h
+++ b/alib2data/src/tree/ranked/PrefixRankedBarPattern.h
@@ -112,16 +112,18 @@ public:
 	explicit PrefixRankedBarPattern ( ext::set < common::ranked_symbol < SymbolType, RankType > > bar, common::ranked_symbol < SymbolType, RankType > variablesBar, 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 RankedPattern. The linear representation is constructed (including bars) by preorder traversal on the tree parameter. Bars and variables bar are provided as parameters.
+	 * \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.
 	 *
-	 * \param tree RankedTree representation of a tree.
+	 * \param barBase the symbol part of all bars
+	 * \param variablesBar the bar to match the subtree wildcard
+	 * \param tree representation of a pattern.
 	 */
 	explicit PrefixRankedBarPattern ( SymbolType barBase, common::ranked_symbol < SymbolType, RankType > variablesBar, const RankedPattern < SymbolType, RankType > & tree );
 
 	/**
 	 * \brief Creates a new instance of the pattern based on the PrefixRankedBarTree. The linear representation is copied from tree. Bars and alphabet as well. Variables bar and subtree wildcard are defaultly constructed.
 	 *
-	 * \param tree RankedTree representation of a tree.
+	 * \param tree representation of a tree.
 	 */
 	explicit PrefixRankedBarPattern ( const PrefixRankedBarTree < SymbolType, RankType > & tree );
 
diff --git a/alib2data/src/tree/ranked/PrefixRankedBarTree.h b/alib2data/src/tree/ranked/PrefixRankedBarTree.h
index e18bb6c714b661f35325fa70938bc1870f2fb2e2..4997fdf9f2cfb3c9b0878d402d52cf3aeeffbb1d 100644
--- a/alib2data/src/tree/ranked/PrefixRankedBarTree.h
+++ b/alib2data/src/tree/ranked/PrefixRankedBarTree.h
@@ -102,9 +102,9 @@ public:
 	explicit PrefixRankedBarTree ( ext::set < common::ranked_symbol < SymbolType, RankType > > bars, ext::vector < common::ranked_symbol < SymbolType, RankType > > data );
 
 	/**
-	 * \brief Creates a new instance of the tree based on the RankedTree. The linear representation is constructed (including bars) by preorder traversal on the tree parameter. All bar symbols (ranked symbols) have the symbol part created from the barBase parameter. The rank part of each bar is computed according to the number of children of the respective node.
+	 * \brief Creates a new instance of the tree based on the RankedTree. The linear representation is constructed (including bars) by preorder traversal on the tree parameter. Symbol part of bars is provided as a parameter.
 	 *
-	 * \param barBase a symbol to be used as symbol part of a ranked symbol of each bar.
+	 * \param barBase the symbol part of all bars
 	 * \param tree RankedTree representation of a tree.
 	 */
 	explicit PrefixRankedBarTree ( SymbolType barBase, const RankedTree < SymbolType, RankType > & tree );