minor refactoring and doc updates