First version of better template updating