moved HMM out