Refactoring chat validation and form-reset.