added filter as optional parameter