Some small refactoring and documentation update.
Added first version of documentation.