First draft of autoswitch