added an optional callback function "unload"