before refactoring bit flip