code refactoring...
 - add valid check in builder.js