Added documentation. Some cosmetical changes.