Modified cache matrix to add functions