Some cleanup in mhsm.c