This looks suspicious: the else if starts in the middle of the if block.
I'd expect it to be  `} else if (condition) {` instead of `else if (condition) {`