Another hmm implementation, it works!