Assign handlers to "self". Towards better handling of subscription and unsubscription. Minor fixes.
Segregate and atomize into classes.