Make output more compact.

Use TextWriter instead of StringBuilder. Don't always append .0 if not necessary.  Also clean up and remove some unused code.