Replace qmode_map lookup table with switch statement