major structure change to support node.js