modified for arrays to templates