Switched from IORefs to StateT