Modified balenceParens function to fix a style warning in original submission.