JSON experiments, minor refactoring