fixed formatArray and doMath to handle cases where there's a single number in parentheses