illegal else without matching if
You code includes an else without a matching if. Make sure each else is matched with an if.