improved switch config parsing