Use StringBuilder rather than StringBuffer to hold the output