Added memoizer to HMM class