Provides proper callbacks for type change.
Adds the actual type change code.