Updated the template list function to work with the updated structure