solved filtering bug. added unit tests.