Use normalize_uri() and general cleanup