Part way attempt to implement template expansion