prepare to be more configurable on filtering.

one new thing is to introduce configuration type, which holds together
all the things which can be configurable about filtering. the other is
to introduce output file handle type, which carries around those values
instead of passing as separate parameter.