Tidied up channel prototyping code a bit.