Added JSON dump, reorganized tests