Minor fixes, updated documentation.
Some refactoring and  added documentation.
Added SpanItem and interfaces. Bugfixes and documentation.