refactor code of filters