small modification to read switches as well