improve the filtering functionality