some refactorings - renamed tokens -> elements;
added javadocs