HMM code added