Assigning tags sorted

but only existing tags, new tags have to tested and inserted