Added extra check for version of GHPython

Also modified/cleaned up parts of the code