Better toggle switch handling