generalized pairs.h to product.h