Minor refactoring of url_join() function to be more generic