filtering should be inclusive in both ends