started rewrite using new-found JSON output format