better template code