Made patternfunc take explicit parameters (were scope implicit).