Positional Forms as Contextual Alternates problems

Hi,
I’m working on a font that has contextual alternates that I want to cycle, and also has some INITIAL forms. Is it possible to have both in the calt feature? When I write the code in the calt feature (from the Part 4 positional alternates tutorial), this is what happens…

So, not only is it subbing out all median for the initial form (even if it isn’t an initial ), it is also ignoring the sub “r r by r.ss02”…
So, i need to know if it is possible to have these two features exist in calt, and also why is it subbing all letters, not just inital forms??

You explicitly substitute all medial forms with initial forms right before the lookup. I suppose this is unintentional?

Oh, I was just following the Writing Feature Code directions. So if I delete that the s02 subs should work too??

Yes, I see. I deleted that line and now everything works.
Thanks. You guys are awesome.

Depends on what your Initial and Medial classes look like. Try it.