Strongly refactor code. Modified approach to the construction of the element tree. Examples dir has been added.