hmm2 optimizations