add filters.ml
move filter code from codegen to filters module