Added functionality for creating matrices, and caching their inverses