Made some extra refactoring and rewritten some domain documentation.