Re-implemented channels using generators.