fix some typos in comments
make sure proper path encoding is applied in all code paths
refactor UrlModes enum to class with singleton constants