Refactor input, switch, select