parseUrl refactored