refactoring and some doc edits