intital implementation of cache matrix logic