First rewrite to use JSON instead of CSV