[Minor] Removed console.log and replaced .unload() (deprecated) with .on(unload)