Various fixes and improvements as requested and approved by @coffins