Fix script to work with standard core, pep8 fixes