Changes and additions to set_query & set_query_base_val