Add tests for siFilter and improve algorithm