Finished bit flip function