smarter templates
small fixes to init & templates