Extracted the channel stuff into its own file. Updated the rest of my
code to use the new channel representation.