Refactor FlipPreferencesTables