In post 1, the GOTO MAINLOOP is in the wrong place. Move it to before the "recording" label.

It may still not do what you're looking for, but fix that for sure.