In the original code, only ']' is checked for, but in the new code '[' is checked for as well. Intentional?