Refactor ChatInputCtrl