This closes #2 : switch to JSON
part of #4 and #5
minor: remove some unused imports, formatting
fix #7