Fixed a few bugs and made the scripts proper executables.