updating parenthesis handling code