Changed the function object constructor to a function literal to avoid CSP issues