I've made the exact same comment last week...
"ENDIF" should replace "IF (condition) THEN" is this exact same situation.