updated parsing of urls using urlparse