Much better parsing of URL