changed prints to logging calls and stop listen while connected