Extracted out a subscribeToChannel function