Improve URL parsing

You can now be more robust in the URLs passed into the client creation fn.