Wow, all of that code! I suggest that after this problem is resolved, you take some time to look at the extensions that are available in Tags to help you make full use of them instead. Otherwise, what's the point of using Tags, really?
Your code looks correct. However, I noticed that you don't have ...