updated check parens general case script