updated CT8 to use new template metadata API, cleaned up some of the logic