`createFilter` could be extracted in to a factory class.