Replace switch with if in readCfg