documentation fixes, refactoring