added HMM implementation by AustinRochford