You should describe your problem better. WHAT does not work?
Does it turn off at all? or is it turning back on that is the problem?
Waits are not encouraged by the way, it tends to fuck up triggers a lot.
That aside, use loops to reduce number of code lines, you can find info by searching the forum most likely.