smart parenthesizing