made small tweaks to bracketX to remove empty parenthesis