Revising cachematrix

completing the assignment