update templates, add some utils