refactored subscribe/unsubscribe logic into a new method
refactored subscribe/unsubscribe logic into a new method