Code cleanup of channel_scan.sh