channel implementation, for reference