template file related changes and few related fixes. check commit id for details.