refactored filtering to separate class