capture state in mh function