refactor to save package.json too