ENH speed improvements in HMM