added template.nit and various fixes