Filter now uses generics to check type of expected value