Documentation greatly improved; added $scheme_name; safety() now prevents changes on failure; $authority no longer contains scheme.