Improved Python version check, deleted redundant code