implement support for multiple matrix rows