Implement SharedPtr structure
Rewrite channels using SharedPtr