update documentation and fix comment
code style fixes and minor refactoring
update documentation