Added support for adding/removing events to be detected on a pin