add on event handler that takes in objects