Small refactoring in python scripts.