If I'm understanding your program correctly, you need else and if to be one word. You'll also need an endif to end the last if-then statement.