fix and add some documentation.