made more generic (allowing more observed columns than 2)