Added a checking of balancing brackets.