Refactor
Export to JSON
Add a flag