Refactored insert_dynamic_url_parameters for readability