misc fixes and huge templates update