I’m working on my version of this right now and I find it to be quite tricky. Yours seems to work great. I can add a stock, remove a stock and it updates properly.
Thank you very much! Although it seems like everything works correctly, I’m not entirely sure I did it right .