Added python refactoring