some modifications using boost dynamicabitset
intermediate state only for backup