Hmm, this filtering sounds very much like what's known pipelining or flow-based programming. Rather handily there's a module for doing just this sort of thing, appopriately going by the name of Pipeline. There's also a node on the subject of flow-based programming, Future of FBP written by none other than the author of Flow-Based Programming: A New Approach to Application Development, J. Paul Morrison.
HTH