Refactored URL handling methods.