improved compile/deploy script by adding debug argument (avoids sending a mail every time), fixing a php parsing error, and cleaning some code