Edited original R file to contain Matrix cache functions