updated documentation, small refactoring