Closes #3414853
We cannot use "this" in the JS arrow functions as it will be undefined in most cases. This MR replaces "this" where it is possible to do and rollback changes where is not.