Improved Parser to catch unbalanced brackets;