Added addEvent().  This is a prototype function.  It might work as is, but it needs to be tested with the type of input it is going to receive to be sure.