domain py scripts refactoring