Improve URL parsing and params initialization