move heartbeat checking to where it makes sense