Improve URL builiding