Commonjs refactoring