Adding some HMM stuff