modified half for the nested parens issue