Autocomplete tags, some code changes