modified to be enable to run in node js