Added the HMM code