Documentation update and small refactoring