documentation and various minor improvements