I know that you want to sort tags with this sort function, but I didn't see you call this from anywhere in this file.