Various small changes found in orphaned version from tmitchell.