::::Hi Dudemanfellabra, thanks for your explanation on the sortkey stuff. Now I understand. All the stuff about sortkey. And as you argued that total restructuring of the code would be necessary. One idea to solve this is to create hidden red links containing the ID from the templates on commons in a systematic way (a simple change in some templates), which will allow to find via 'what links here' all images and categories containing that ID. Such a red link would also help users to collect all the images with the same id even without having a category and without using external tools, purely based on Mediawiki software.