An implementation for HSMM