rewrote to work with node-webkit.