Input switching logic