I thought I could make the necessary changes to my code in about 10 minutes. It turned out to be an hour and a half instead.
However, the code now works as well as it can for this stage of the proceedings, which is a good thing.
(Especially since there's a demo tomorrow. :) )