revise to make it suitable for node-webkit