modified implementation so that the 'export' of the function is controlled in both webbrowser and nodejs