channels read/writes refactoring