The second version of your script is very similar to what I have. Including how you did the $submenu() stuff. I just loop through making my popup text file a bit differently and have it organized another way.
on *:start: hw_update
on *:connect: hw_update
on *:disconnect: .timer -im 1 100 hw_update
on *:load: hw_update
on *:unload:{ .unload -rs $scriptdirhide_windows.txt | .remove $scriptdirhide_windows.txt }
That's what I have for updating it, that does a pretty good job. Only thing those don't do it update when you open a status and don't connect.
I guess I'll just leave it at that for now. I just prefer making scripts as bullet proof as possible