URIUtils: reorganize code