Consecutive contextual alts

Hello. I’m building a font with a contextual alternate lowercase ‘o’. The alternate version was built because I think it looks nicer when placed next to certain letters. (k, n, b, etc.)

I’m also trying to keep the style of the ‘o’s unified when placed consecutively. Does anyone have advice on how to achieve this? The image attached contains a success - “kool”. But no luck on words like “Croon” & “look”.

My line of code is as follows:

sub @o_alt_induce_lower o’ by o.alt;

sub o’ @o_alt_induce_lower by o.alt;

sub @o_alt_induce_upper o’ by o.alt;

sub o.alt o’ by o.alt;

I’d appreciate any advice! Thanks

Put the last line into its own lookup and add a line for when the first o.alt is the second glyphs.

lookup alto1 {
sub @o_alt_induce_lower o' by o.alt;

sub o' @o_alt_induce_lower by o.alt;

sub @o_alt_induce_upper o' by o.alt;
} alto1;

lookup alto2 {
sub o' o.alt by o.alt;
sub o.alt o' by o.alt;
} alto2;

Incredible! Worked like a charm. Thanks a lot Georg.