implemented Filter.java and passes tests