Include `id` in output JSON.

And minor code improvement & documentation around the file naming.