Add tests for filter/merge and fix merge implementation :large_blue_diamond: