Implemented matrix creation
Implemented caching