updated to support nested rows