main filter loop & init vars