Refactoring like python way