The first version of HMM is done.
The updated main script.