refactoring: remove `g :: IORef Int' from processHA