I didn't address SAM at all, other than pointing out that the author's figure did not have a separation of code and display.
I take it that you are the author and I've completely derailed your thread by going off on my own tangent.
Apologies.
I will give it a second read and see if I can't come up with some more relevant feedback for you.