Something i would recommend is NOT using VSYNC or WAIT commands inside secondary loops, since a lot of them will slow down the execution of the main loop. Unless is intended.