Handle Variable-Sized Matrices