Some refactoring on chatInput