Give release scripts ability to handle directories with spaces

This allows release scripts to work when being run from directories with spaces.

I had to refactor some code in the extended script by putting some shellcode in functions so I could properly quote all variables.