TODO row function has a bug. See its previous implementations.