Added comments and refactored cacheSolve to avoid multiple return