improved code style in Node
switched to pure js implementation