Optimized using iteration instead of recursion in various places, T.addTag allows users to add their own tags