Added functionality to deal with the Pages template chooser, when that is used