Refactor the URL utility (for upcoming changes)