Made memoMap even more general.