Add JSON tests, update README, more refactoring