json + slight refactor