Add unit test + refactor filter