mapstate and heu improvements