minor code improvements and better tests for the filter parameter