updated script.js

Updated the script to create the arrays with only the size needed