Added priority to template match to avoid ambiguous rules.