added filter_sequences function