Factor out channel construction into a function

Protects against changes being made to channel structure in the
future.