moving most of the work into builder.sh