Added support for (more) arbitrarily sized matrices