Merge pull request #2127 from TheDigitalOrchard/uri-lib-optimizations

minor tweaks and optimizations to URI library