Algorithm for applying filters. Move tests and add tests.