implemented cached filetering and weigthing