Add dirty channels search implementation and fix a bug in 'c'