Refactoring, testing and fixing variant filter