set up to work in node and browser (amd)