Also, get rid of that END statement that's just above the WEND. The END statement will force the program to exit before the WEND sets the instruction pointer back up to the WHILE statement.