Added exporting to json as intermediary step