I edited the code and then realized that I should not have. I was not able to re-edit it back because you had posted to the thread. Replace lines 17 and 18 with the following:
if (timer == 0) // ... game over routine }

