refactoring py files