Adds event handling for on class change