Made the script compatible with Node.JS