proper URL parsing and handling