further refactoring, precomputing row arrays is no longer necessary