Get rid of match statements in layout queries in script_task