refactor channel xs to be more testable