var iotivity = require( "bindings" )( "iotivity" ),
	_ = require( "underscore" ),
	OicResource = require( "./OicResource" ).OicResource,
	OicClient = function() {
		if ( !this._isOicClient ) {
			return new OicClient();
		}

	};

_.extend( OicClient.prototype, {
	_isOicClient: true,
	onresourcechange: null,
	onresourcefound: null,
	ondevicefound: null,
	listeners: {},

	addEventListener: function( event, callback ) {
		if ( !( event in this.listeners ) ) {
			this.listeners[ event ] = [];
		}

		// Currently allows duplicate callbacks. Should it?
		this.listeners[ event ].push( callback );
	},

	removeEventListener: function( event, callback ) {
		if ( event in this.listeners ) {
			this.listeners[ event ] = this.listeners[ event ].filter( function( ev ) {
				return ev !== callback;
			} );
		}
	},

	dispatchEvent: function( event, request ) {
		if ( typeof this[ "on" + event ] === "function" ) {
			this[ "on" + event ]( request );
		}
		if ( event in this.listeners ) {
			for ( var i = 0, len = this.listeners[ event ].length; i < len; i++ ) {
				this.listeners[ event ][ i ].call( this, request );
			}
		}
	},

	findResources: function( options ) {}
} );

module.exports = {
	OicClient: OicClient
};

@@ -223,16 +223,92 @@
 %7D%0A%0A%09%7D;%0A%0A
+require( %22util%22 ).inherits( OicClient, require( %22events%22 ).EventEmitter );%0A%0A
 _.extend
@@ -427,24 +427,8 @@
 ull,
-%0A%09listeners: %7B%7D,
 %0A%0A%09a
@@ -480,169 +480,32 @@
 %7B%0A%09%09
-if ( !( event in this.listeners ) ) %7B%0A%09%09%09this.listeners%5B event %5D = %5B%5D;%0A%09%09%7D%0A%0A%09%09// Currently allows duplicate callbacks. Should it?%0A%09%09this.l
+this.addL
 istener
-s%5B
+(
  event
- %5D.push(
+,
  cal
@@ -576,456 +576,210 @@
 %7B%0A%09%09
-if ( event in this.listeners ) %7B%0A%09%09%09this.listeners%5B event %5D = this.listeners%5B event %5D.filter( function( ev ) %7B%0A%09%09%09%09return ev !== callback;%0A%09%09%09%7D );%0A%09%09%7D%0A%09%7D,%0A%0A%09dispatchEvent: function( event, request ) %7B%0A%09%09if ( typeof this%5B %22on%22 + event %5D === %22function%22 ) %7B%0A%09%09%09this%5B %22on%22 + event %5D( request );%0A%09%09%7D%0A%09%09if ( event in this.listeners ) %7B%0A%09%09%09for ( var i = 0, len = this.listeners%5B event %5D.length; i %3C len; i++ ) %7B%0A%09%09%09%09this.listeners%5B event %5D%5B i %5D.call( this
+this.removeListener( event, callback );%0A%09%7D,%0A%0A%09dispatchEvent: function( event, request ) %7B%0A%09%09if ( typeof this%5B %22on%22 + event %5D === %22function%22 ) %7B%0A%09%09%09this%5B %22on%22 + event %5D( request );%0A%09%09%7D%0A%09%09this.emit( event
 , re
@@ -791,17 +791,8 @@
  );%0A
-%09%09%09%7D%0A%09%09%7D%0A
 %09%7D,%0A

Use node's own event infrastructure