refactoring
save flags as json introduced