Implemented cacheSolve and added comments.