refactor to node module