Fixed multiple misspellings and split memoization into its own method.