MVar -> IORef + golfing