rework sorting of tags, implement tags of toplevel functions - introduce new repeatable kinds of tags that later are resolved to single unique tag, fix tests