refactor domains py scripts