Refactored python files