Most or all of this could be removed when autosuggest is used.