Made filter design more general