Merge Hegara's change with python scripts