Re-factored some of the URL scalar functions