improved the switch