Prevents duplicate switches

Also removes some unnecessary code