Improve template introspection