edited cachematrix code for initial upload