Removed duplicate code. Refactored everything into swich_channel