That semicolon on the end of your if line basically ended the IF before it had done anything, therefore the code on the lines after it was being executed no matter what the conditions were. When it got to the else the compiler was litterally confused because it couldn't find the IF you were talking about. I didn't change the code much else besides that, just added some braces for clarity.