Added validation for autocomplete