window unload function added, previous log messages updated as per the new documentation