Improve URL parsing