Use STM instead of IORef