Make channel matching more robust by moving channel mapping into common.h