Fixup output.js.

1. Centralize logging into a single func/
  1.a - helper functions return strings and do not assume output
2. Fixup unused params and default param setting
3. Removed unused methods.