Made memoMap more general.