added changes to template viewer for supporting displaying multiple templates