Move logic to builder.js