Add ability to insert template at selected index