Working on stack-rebuild.js

Getting back to the basics, cleaning up js file.