Fixed chan type
Refactoring.