Fixed cutOuterBrackets()

This method previously failed to deal with with possibility that we may have more than one set of outer brackets. This update fixes this.