improved the notes and example implementation. Associativity actually isn't an issue at the level of conditions, so recursion is fine.