Adjust code to be more nodejs-friendly.