Alex,
As I'm looking through your code, I'm having a really hard time following what's going on. Is there a good guide anywhere on how mach 3 handles variables and subroutines? Perhaps you could comment your code a bit more or describe a general code flow?
At the end of the day, I'm hesitant to set my look ahead to 1 but it's probably not a bad idea to understand how this works.