Replaced FIXED_NDIM with templates