Refactoring into node module