Added parenthesis match checking