minor fix

* update comments
* name a function that is patched in native function
* use the arrow function to the callback function
clean up on window close
optimize |openLink| function