updated functions returned by doRule so that they can take another argrument