Various fixes and doc improvements