Extracted some state tools to HNHCommon