Some refactoring in channels.rb for improved elegance and clarity.