Changed to use an EventEmitter instead.

This ends up being much cleaner and simpler.