Build lookup tables for switches (PR884)