Cleanup code for channelscanning