Various improvements and default main now accepts JSON for the answer.