Made scripts more efficient, and some PEP-08 fixes