Fix #119; cache class in abstract filter

This introduces a slight change in behavior, which is why the tests had to change. See #119 for details.

Like #117, this speeds things up by a couple orders of magnitude.