changed filter function signature to allow tuning