Final version of cach matrix