Cleaning up path setup and SGE script to work more reliably.