removed and optimized base codes for HMMs