script now hopefully handles disconnects