Added the ability to pass in an object with events