working version in node