Add filter and reduce implementation