Improve template extension