Some simple implemention of HMM algorithm