add some documentation and comments