updated documentation and comments