added stack and check if brackets match