Add channel index, refactor.