Rewrite functions with comments and linting.
Rewrite URL processing functions with strict error checking.