big bit flip refactor