Plugin event generalization

This should help you a little to start with plugin support.