modified the driver to exit when there are no channels remaining