Add forward procedure for hmm
Implement backward procedure for hmm
Clean up forward and backward procedures. Add docs.