Add documentation for some functions, fix some doc strings