Forward port Templates functionality

Change-Id: Ieb9e54249dd512e65f23f32d503d11fba88335ee