Working on the HMM training