Wrote up JSON docs and tidied up