Template changes to support generics