Impliments filter.by function